Drupal\Component\DependencyInjection\ReverseContainer::generateServiceIdHash(): after installing libraries module

Created on 19 June 2023, over 1 year ago

When i installed latest version of library module. I am getting below error
TypeError: Drupal\Component\DependencyInjection\ReverseContainer::generateServiceIdHash(): Argument #1 ($object) must be of type object, null given in Drupal\Component\DependencyInjection\ReverseContainer->generateServiceIdHash() (line 87 of /home/vsts/work/1/s/docroot/core/lib/Drupal/Component/DependencyInjection/ReverseContainer.php) #0 [internal function]: Drupal\Component\DependencyInjection\ReverseContainer->generateServiceIdHash(

My environment config is below
Drupal version : 10.0.9
libraries module version : 4.0.4
PHP version: 8.1

🐛 Bug report
Status

Active

Version

4.0

Component

Code

Created by

🇮🇳India ashetkar

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

Merge Requests

Comments & Activities

  • Issue created by @ashetkar
  • 🇺🇸United States TolstoyDotCom L.A.

    I was able to install it without error on Drupal 10.0.9. That's using PHP 8.2 so it could be that, but the more likely explanation is something else you already have installed. Try disabling other things and clearing cache afterwards to pin it down.

  • 🇺🇸United States alfattal Minnesota

    @TolstoyDotCom Like, what otherings?

  • 🇺🇸United States TolstoyDotCom L.A.

    Without a full stack trace and without OP trying what I suggested it's hard to tell what it could be.

  • 🇨🇦Canada joseph.olstad

    What you can do is use this debugging technique and look at the stack of calls, look for module names and library names involved.

    look at the comments on this page, explains a bit , put the debug right in the file that is throwing the error.

    https://www.php.net/manual/en/function.debug-print-backtrace.php

  • Status changed to Postponed: needs info over 1 year ago
  • 🇺🇸United States alfattal Minnesota

    @joseph.olstad Here is the full backtrace for the error I'm getting:

     [error]  TypeError: Drupal\Component\DependencyInjection\ReverseContainer::generateServiceIdHash(): Argument #1 ($object) must be of type object, null given in Drupal\Component\DependencyInjection\ReverseContainer->generateServiceIdHash() (line 87 of ../docroot/core/lib/Drupal/Component/DependencyInjection/ReverseContainer.php) #0 [internal function]: Drupal\Component\DependencyInjection\ReverseContainer->generateServiceIdHash()
    #1 ../docroot/core/lib/Drupal/Component/DependencyInjection/ReverseContainer.php(75): array_map()
    #2 ../docroot/core/lib/Drupal/Core/DrupalKernel.php(903): Drupal\Component\DependencyInjection\ReverseContainer->recordContainer()
    #3 ../vendor/drush/drush/src/Drupal/DrupalKernelTrait.php(72): Drupal\Core\DrupalKernel->initializeContainer()
    #4 ../docroot/core/lib/Drupal/Core/DrupalKernel.php(816): Drush\Drupal\DrupalKernel->initializeContainer()
    #5 ../docroot/core/lib/Drupal/Core/Extension/ModuleInstaller.php(608): Drupal\Core\DrupalKernel->updateModules()
    #6 ../docroot/core/lib/Drupal/Core/Extension/ModuleInstaller.php(244): Drupal\Core\Extension\ModuleInstaller->updateKernel()
    #7 ../docroot/core/lib/Drupal/Core/ProxyClass/Extension/ModuleInstaller.php(83): Drupal\Core\Extension\ModuleInstaller->install()
    #8 ../docroot/core/lib/Drupal/Core/Config/ConfigImporter.php(872): Drupal\Core\ProxyClass\Extension\ModuleInstaller->install()
    #9 ../docroot/core/lib/Drupal/Core/Config/ConfigImporter.php(624): Drupal\Core\Config\ConfigImporter->processExtension()
    #10 ../docroot/core/lib/Drupal/Core/Config/ConfigImporter.php(561): Drupal\Core\Config\ConfigImporter->processExtensions()
    #11 ../vendor/drush/drush/src/Commands/config/ConfigImportCommands.php(259): Drupal\Core\Config\ConfigImporter->doSyncStep()
    #12 ../vendor/drush/drush/includes/drush.inc(62): Drush\Commands\config\ConfigImportCommands->doImport()
    #13 ../vendor/drush/drush/includes/drush.inc(53): drush_call_user_func_array()
    #14 ../vendor/drush/drush/src/Commands/config/ConfigImportCommands.php(230): drush_op()
    #15 [internal function]: Drush\Commands\config\ConfigImportCommands->import()
    #16 ../vendor/consolidation/annotated-command/src/CommandProcessor.php(276): call_user_func_array()
    #17 ../vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback()
    #18 ../vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter()
    #19 ../vendor/consolidation/annotated-command/src/AnnotatedCommand.php(391): Consolidation\AnnotatedCommand\CommandProcessor->process()
    #20 ../vendor/symfony/console/Command/Command.php(326): Consolidation\AnnotatedCommand\AnnotatedCommand->execute()
    #21 ../vendor/symfony/console/Application.php(1081): Symfony\Component\Console\Command\Command->run()
    #22 ../vendor/symfony/console/Application.php(320): Symfony\Component\Console\Application->doRunCommand()
    #23 ../vendor/symfony/console/Application.php(174): Symfony\Component\Console\Application->doRun()
    #24 ../vendor/drush/drush/src/Runtime/Runtime.php(110): Symfony\Component\Console\Application->run()
    #25 ../vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun()
    #26 ../vendor/drush/drush/drush.php(139): Drush\Runtime\Runtime->run()
    #27 ../vendor/drush/drush/drush(4): require('...')
    #28 ../vendor/bin/drush(117): include('...')
    #29 {main}.
  • 🇨🇦Canada joseph.olstad

    @alfattal, thanks for that however it doesn't say "which" dependency is causing the problem, the default core exception in this case is not helpful.

    I suggest having a look at the debug technique shown in the link I mentioned here:

    https://www.php.net/manual/en/function.debug-print-backtrace.php

    I had some good luck with the last example mentioned in the comments , the A, B and C class.

    With that said, the others may be simpler if you have issues try the others. I was able to get the last example working and it was very helpful.

  • 🇺🇸United States trigve hagen Washington DC

    You may need to have HAL installed. That fixed mine.

  • 🇮🇳India rakshith.thotada

    I think if you have exported libraries config to default folder -> libraries.settings.yml - Delete it and setup in CI should work fine.
    This I tried after a lot of iteration. Finally it worked

  • 🇳🇱Netherlands edvanleeuwen Waalwijk

    I have the same error. If I install libraries last, it is okay.

  • 🇨🇦Canada danrod Ottawa

    I am having the same issue if I list the libraries module as a dependency in my custom module *.info.yml file.

  • First commit to issue fork.
  • Pipeline finished with Failed
    4 months ago
    Total: 340s
    #284956
  • 🇮🇳India abhinesh

    It seems there is an error with the "libraries.settings.yml" configuration. I moved it to the optional directory as a temporary solution.

  • Status changed to Needs review 4 months ago
  • 🇨🇦Canada joseph.olstad

    Curiously, the pipeline has several failures with this change.

  • Status changed to RTBC about 1 month ago
  • 🇦🇺Australia realityloop

    I can confirm this issue was causing test fails for toggle_editable_fields module, I had to add the following to the ci task so that it would pass:

    .composer-base:
      before_script:
        - composer require drupal/libraries:^4.0 --no-update
      after_script:
        - mkdir $_WEB_ROOT/modules/contrib/libraries/config/optional
        - mv $_WEB_ROOT/modules/contrib/libraries/config/install/libraries.settings.yml $_WEB_ROOT/modules/contrib/libraries/config/optional/libraries.settings.yml
    
Production build 0.71.5 2024