ArgumentCountError: Too few arguments to function Drupal\scheduler\SchedulerManager::__construct(), 7 passed, 9 expected

Created on 28 September 2023, 8 months ago

Problem/Motivation

I am using Scheduler version 1.4.0 and Scheduler Content Moderation Integration 1.4. I want to update both to ^2.0. I was unable to upgrade either module due to composer conflicts with each other's versions. There is a deadlock where Scheduler wants a higher version of SCMI, and SCMI wants a higher version of Scheduler. The solution I came up with was this: composer require 'drupal/scheduler_content_moderation_integration:^2.0@beta' 'drupal/scheduler:^2.0'. This allowed the modules to be upgraded.

However, it crashed our site. Oddly, on a test site, there was no issue. On production, the site crashed with this error:

The website encountered an unexpected error. Please try again later.
ArgumentCountError: Too few arguments to function Drupal\scheduler\SchedulerManager::__construct(), 7 passed in /home/limestonedouglas/public_html/web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 259 and exactly 9 expected in Drupal\scheduler\SchedulerManager->__construct() (line 96 of modules/contrib/scheduler/src/SchedulerManager.php).
Drupal\scheduler\SchedulerManager->__construct() (Line: 259)
Drupal\Component\DependencyInjection\Container->createService() (Line: 177)
Drupal\Component\DependencyInjection\Container->get() (Line: 207)
Drupal::service() (Line: 18)
Drupal\scheduler\Theme\SchedulerThemeNegotiator->applies() (Line: 67)
Drupal\Core\Theme\ThemeNegotiator->determineActiveTheme() (Line: 405)
Drupal\Core\Theme\ThemeManager->initTheme() (Line: 96)
Drupal\Core\Theme\ThemeManager->getActiveTheme() (Line: 233)
Drupal\Core\Theme\Registry->init() (Line: 277)
Drupal\Core\Theme\Registry->getRuntime() (Line: 194)
Drupal\Core\Entity\EntityViewBuilder->getBuildDefaults() (Line: 61)
Drupal\node\NodeViewBuilder->getBuildDefaults() (Line: 157)
Drupal\Core\Entity\EntityViewBuilder->viewMultiple() (Line: 123)
Drupal\Core\Entity\EntityViewBuilder->view() (Line: 134)
Drupal\Core\Entity\Controller\EntityViewController->view() (Line: 66)
Drupal\node\Controller\NodeViewController->view()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 169)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 81)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 58)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 23)
Stack\StackedHttpKernel->handle() (Line: 718)
Drupal\Core\DrupalKernel->handle() (Line: 19)

I'm not sure what to do now. I hope this error provides clues.

Steps to reproduce

Using Drupal 9.5.10, with the module versions shown above. Try to update either module using composer. I was unable to do this. By adding them both to the same composer require command, I was able to upgrade. This crashed my site completely. No page was accessible at this point, so I downgraded back to previous versions.

πŸ’¬ Support request
Status

Fixed

Version

1.4

Component

Miscellaneous

Created by

πŸ‡ΊπŸ‡ΈUnited States rraney

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @rraney
  • πŸ‡ΊπŸ‡ΈUnited States rraney
  • πŸ‡¬πŸ‡§United Kingdom jonathan1055
    ArgumentCountError: Too few arguments to function Drupal\scheduler\SchedulerManager::__construct(),
    7 passed in core/lib/Drupal/Component/DependencyInjection/Container.php on line 259
    and exactly 9 expected in Drupal\scheduler\SchedulerManager->__construct()
    (line 96 of modules/contrib/scheduler/src/SchedulerManager.php)
    

    SchedulerManager does require 9 arguments in 2.0, see SchedulerManager.php line 96

    These 9 arguments are define and provided in scheduler.services.yml

    So if only 7 are being passed (which it was in Scheduler 8.x-1.x) it implies that the updated scheduler.services file is not being respected. Have you cleared the cache? If that does not work, a drastic measure would be to stop and re-start your server, but that might not be possible on your production environment. There should be a way to resolve this, as you clearly did it in your test environment OK.

  • πŸ‡ΊπŸ‡ΈUnited States rraney

    I thought I commented already. Maybe it was in the wrong place. I found a similar issue by searching the web. It led me back here to Scheduler issues. The person forgot to run drush cache-rebuild. I almost never do this when I update modules, but this worked. I re-ran the updates, quickly followed by the drush command and the site is working.

    Thanks and sorry, I must have responded in my other issue.

  • Status changed to Fixed 8 months ago
  • πŸ‡¬πŸ‡§United Kingdom jonathan1055

    That's good to hear. Thanks for letting me know.

  • πŸ‡¬πŸ‡§United Kingdom jonathan1055
  • πŸ‡¬πŸ‡§United Kingdom jonathan1055
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.69.0 2024