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

CommentFileSizeAuthor
#15 3367706-15.patch2.33 KBabhinesh

Issue fork libraries-3367706

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

ashetkar created an issue. See original summary.

tolstoydotcom’s picture

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.

alfattal’s picture

@TolstoyDotCom Like, what otherings?

tolstoydotcom’s picture

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

joseph.olstad’s picture

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

joseph.olstad’s picture

Category: Bug report » Support request
Status: Active » Postponed (maintainer needs more info)
alfattal’s picture

@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}.
joseph.olstad’s picture

@alfattal, thanks for that however it doesn't say "which" dependency or module or library or theme 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 (mentioned above also):

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.

trigve hagen’s picture

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

rakshith.thotada’s picture

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

Also after libraries module installation - reexport the config

edvanleeuwen’s picture

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

danrod’s picture

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

abhinesh made their first commit to this issue’s fork.

abhinesh’s picture

StatusFileSize
new2.33 KB

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

joseph.olstad’s picture

Status: Postponed (maintainer needs more info) » Needs review
joseph.olstad’s picture

Curiously, the pipeline has several failures with this change.

realityloop’s picture

Status: Needs review » Reviewed & tested by the community

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

  • joseph.olstad committed c1d638cd on 4.0.x
    [#3367706] fix: Drupal\Component\DependencyInjection\ReverseContainer::...
joseph.olstad’s picture

Version: 4.0.4 » 4.0.x-dev
Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

  • joseph.olstad committed 6069ff9b on 4.0.x
    Revert "[#3367706] fix: Drupal\Component\DependencyInjection\...
joseph.olstad’s picture

Status: Fixed » Needs work

This change breaks automated test.

dak5859’s picture

Any other movement on this issue? I'm still seeing this same error on fresh installs. Not seeing any fixes in this thread.

Drupal version : 10.0.9
Libraries module version : 4.1.1
PHP version: 8.1

ejanus’s picture

I'm running into this on my build step as well.

Drupal: 10.5.4
libraries: 4.1.1
PHP: 8.3.27

Using patch #15 in this issue for some time and it works on other env. Odd will report back if I have an exact reason some environments (local) build and my new macbook setup does not.

Since I'm still using BLT, I added libraries under

...
modules:
  local:
     enable: [..., libraries]
...

As a temp fix.