when execute "drush cron" in terminal;
this error occured:
#1 /docroot/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(692): Drupal\Core\Entity\EntityStorageBase->doPreSave(Object(Drupal\feeds\Entity\Feed))
#2 /docroot/core/lib/Drupal/Core/Entity/EntityStorageBase.php(454): Drupal\Core\Entity\ContentEntityStorageBase->doPreSave(Object(Drupal\feeds\Entity\Feed))
#3 /docroot/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(838): Drupal\Core\Entity\EntityStorageBase->save(Object(Drupal\feeds\Entity\Feed))
#4 /docroot/core/lib/Drupal/Core/Entity/EntityBase.php(394): Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object(Drupal\feeds\Entity\Feed))
#5 /docroot/modules/contrib/feeds/src/FeedImportHandler.php(305): Drupal\Core\Entity\EntityBase->save()
#6 /docroot/modules/contrib/feeds/src/Entity/Feed.php(260): Drupal\feeds\FeedImportHandler->startCronImport(Object(Drupal\feeds\Entity\Feed))
#7 /docroot/modules/contrib/feeds/feeds.module(90): Drupal\feeds\Entity\Feed->startCronImport()
#8 [internal function]: feeds_cron()
#9 /docroot/core/lib/Drupal/Core/Extension/ModuleHandler.php(392): call_user_func_array('feeds_cron', Array)
#10 /docroot/core/lib/Drupal/Core/Cron.php(236): Drupal\Core\Extension\ModuleHandler->invoke('feeds', 'cron')
#11 /docroot/core/lib/Drupal/Core/Cron.php(134): Drupal\Core\Cron->invokeCronHandlers()
#12 /docroot/core/lib/Drupal/Core/ProxyClass/Cron.php(75): Drupal\Core\Cron->run()
#13 /vendor/drush/drush/src/Drupal/Commands/core/DrupalCommands.php(59): Drupal\Core\ProxyClass\Cron->run()
#14 [internal function]: Drush\Drupal\Commands\core\DrupalCommands->cron(Array)
#15 /vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array(Array, Array)
#16 /vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
#17 /vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#18 /vendor/consolidation/annotated-command/src/AnnotatedCommand.php(302): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#19 /vendor/symfony/console/Command/Command.php(255): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#20 /vendor/symfony/console/Application.php(1000): Symfony\Component\Console\Command\Command->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))#21 /vendor/symfony/console/Application.php(255): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 /vendor/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#23 /vendor/drush/drush/src/Runtime/Runtime.php(118): Symfony\Component\Console\Application->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#24 /vendor/drush/drush/src/Runtime/Runtime.php(49): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
#25 /vendor/drush/drush/drush.php(72): Drush\Runtime\Runtime->run(Array)
#26 /vendor/drush/drush/includes/preflight.inc(18): require('/var/www/html/w...')
#27 phar:///usr/local/bin/drush/bin/drush.php(141): drush_main()
#28 /usr/local/bin/drush(10): require('phar:///usr/loc...')
#29 {main}
Error: Call to a member function getPlugins() on null in Drupal\feeds\Entity\Feed->preSave() (line 512 of /docroot/modules/contrib/feeds/src/Entity/Feed.php).
[warning] Drush command terminated abnormally. Check for an exit() in your Drupal site.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | feeds-deleted-feed-type-3104727-7.patch | 3.71 KB | megachriz |
| #7 | feeds-deleted-feed-type-3104727-7-tests-only.patch | 1.61 KB | megachriz |
| #5 | check_for_null.patch | 426 bytes | developerweeks |
Comments
Comment #2
megachrizCan it be that you did the following?
Because the line where the code failed was trying to call a method on the feed type. It looks like the feed type that the feed in question belonged to couldn't be loaded so it might have been deleted.
Comment #3
megachrizComment #4
prsnjtbarman commentedI got similar error, when 'drush pm-uninstall uc_product'
Error: Call to a member function getPlugins() on null in Drupal\feeds\Entity\Feed->preSave() (line 512 of /var/www/html/drbatrauae/modules/contrib/feeds/src/Entity/Feed.php)
Comment #5
developerweeks commentedMegaChriz, your question in #2 looks like what happened on my local. Where should I go to purge this residue so the feed stops trying to process the ghost of feeds-past? Some context, I'm working in a docker environment and a teammate created some feeds. One of them became obsolete and was deleted. Deleting my containers and initializing the site again causes this error.
[error] Error: Call to a member function getPlugins() on null in Drupal\feeds\Entity\Feed->preSave() (line 517 of /app/wwwroot/modules/contrib/feeds/src/Entity/Feed.php)I would prefer to clean my data instead of patching code to cover for it.
Comment #6
megachriz@developerweeks
You can try to delete feeds tasks from the queue.
To do this in the UI:
Delete records from the database
You can also delete records from the database table "queue". Look for entries whose "name" starts with "feeds_feed_refresh:":
Or if you know the exact name of the deleted feed type:
Comment #7
megachriz@developerweeks
I've done some testing. It turns out that you need to delete (or deactivate) the feeds for which the feed type no longer exists.
The attached patch should prevent the PHP error noted in this issue and log a more useful error message instead:
Comment #9
developerweeks commented@MegaChriz Thank you. #6 had the information I needed to resolve the issue in my workspace, but it was a hectic day and I did not take the time to say it.
Comment #11
megachrizCommitted #7.