TypeError in LinkStatusHandle.php

Created on 1 November 2021, over 2 years ago
Updated 25 April 2024, 2 months ago

I'm getting the following error when running cron with Link Checker enabled on several 9.2.7 sites:

TypeError: Argument 1 passed to Drupal\linkchecker\Plugin\LinkStatusHandlerBase::handle() must implement interface Drupal\linkchecker\LinkCheckerLinkInterface, null given, called in /Users/dicksb/Sites/MAMP/moweb/docroot/modules/contrib/linkchecker/src/Plugin/QueueWorker/LinkStatusHandle.php on line 79 in /Users/dicksb/Sites/MAMP/moweb/docroot/modules/contrib/linkchecker/src/Plugin/LinkStatusHandlerBase.php on line 107 #0 /Users/dicksb/Sites/MAMP/moweb/docroot/modules/contrib/linkchecker/src/Plugin/QueueWorker/LinkStatusHandle.php(79): Drupal\linkchecker\Plugin\LinkStatusHandlerBase->handle(NULL, Object(GuzzleHttp\Psr7\Response))
#1 /Users/dicksb/Sites/MAMP/moweb/docroot/core/lib/Drupal/Core/Cron.php(182): Drupal\linkchecker\Plugin\QueueWorker\LinkStatusHandle->processItem(Array)
#2 /Users/dicksb/Sites/MAMP/moweb/docroot/core/lib/Drupal/Core/Cron.php(147): Drupal\Core\Cron->processQueues()
#3 /Users/dicksb/Sites/MAMP/moweb/docroot/core/lib/Drupal/Core/ProxyClass/Cron.php(75): Drupal\Core\Cron->run()
#4 /Users/dicksb/Sites/MAMP/moweb/vendor/drush/drush/src/Drupal/Commands/core/DrupalCommands.php(76): Drupal\Core\ProxyClass\Cron->run()
#5 [internal function]: Drush\Drupal\Commands\core\DrupalCommands->cron(Array)
#6 /Users/dicksb/Sites/MAMP/moweb/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array(Array, Array)
#7 /Users/dicksb/Sites/MAMP/moweb/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
#8 /Users/dicksb/Sites/MAMP/moweb/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#9 /Users/dicksb/Sites/MAMP/moweb/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(313): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#10 /Users/dicksb/Sites/MAMP/moweb/vendor/symfony/console/Command/Command.php(255): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 /Users/dicksb/Sites/MAMP/moweb/vendor/symfony/console/Application.php(1027): Symfony\Component\Console\Command\Command->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 /Users/dicksb/Sites/MAMP/moweb/vendor/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 /Users/dicksb/Sites/MAMP/moweb/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 /Users/dicksb/Sites/MAMP/moweb/vendor/drush/drush/src/Runtime/Runtime.php(118): Symfony\Component\Console\Application->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 /Users/dicksb/Sites/MAMP/moweb/vendor/drush/drush/src/Runtime/Runtime.php(48): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 /Users/dicksb/Sites/MAMP/moweb/vendor/drush/drush/drush.php(72): Drush\Runtime\Runtime->run(Array)
#17 /Users/dicksb/Sites/MAMP/moweb/vendor/drush/drush/drush(4): require('/Users/dicksb/S...')
#18 {main}
TypeError: Argument 1 passed to Drupal\linkchecker\Plugin\LinkStatusHandlerBase::handle() must implement interface Drupal\linkchecker\LinkCheckerLinkInterface, null given, called in /Users/dicksb/Sites/MAMP/moweb/docroot/modules/contrib/linkchecker/src/Plugin/QueueWorker/LinkStatusHandle.php on line 79 in Drupal\linkchecker\Plugin\LinkStatusHandlerBase->handle() (line 107 of /Users/dicksb/Sites/MAMP/moweb/docroot/modules/contrib/linkchecker/src/Plugin/LinkStatusHandlerBase.php).
 [warning] Drush command terminated abnormally.

I cannot entirely reproduce this. A fresh install using the same core and the same custom install profile seems able to run cron just fine with Link Checker enabled, while (so far) about a half-dozen existing sites (also on the same core) started experiencing this error when Link Checker was enabled.

Uninstalling Link Checker stops the error. Reinstalling it causes the error to return, even if I don't configure any fields to be checked.

Error occurs both on Acquia Cloud and on my local MAMP environment.

Problem occurs with both 1.0-beta and 1.x-dev.

On a fresh install, I cannot reproduce the error even if I enable all the modules that are enabled on the sites where the error occurs.

I'm still trying to isolate this, but I'm hoping someone else may have an idea.

πŸ› Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States wrd-oaitsd

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024