Site install from config throws Call to a member function set Weight() on null...

Created on 6 March 2019, almost 6 years ago
Updated 1 September 2024, 5 months ago

Problem/Motivation

When installing the site via drush si --existing-config -y it throws the following error:

Error: Call to a member function setWeight() on null in /app/webroot/core/modules/language/src/ConfigurableLanguageManager.php on line 357 #0 /app/webroot/core/modules/language/src/Entity/ConfigurableLanguage.php(140): Drupal\language\ConfigurableLanguageManager->updateLockedLanguageWeights()
#1 /app/webroot/core/lib/Drupal/Core/Entity/EntityStorageBase.php(525): Drupal\language\Entity\ConfigurableLanguage->postSave(Object(Drupal\Core\Config\Entity\ConfigEntityStorage), true)
#2 /app/webroot/core/lib/Drupal/Core/Entity/EntityStorageBase.php(451): Drupal\Core\Entity\EntityStorageBase->doPostSave(Object(Drupal\language\Entity\ConfigurableLanguage), true)
#3 /app/webroot/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php(263): Drupal\Core\Entity\EntityStorageBase->save(Object(Drupal\language\Entity\ConfigurableLanguage))
#4 /app/webroot/core/lib/Drupal/Core/Entity/EntityBase.php(394): Drupal\Core\Config\Entity\ConfigEntityStorage->save(Object(Drupal\language\Entity\ConfigurableLanguage))
#5 /app/webroot/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php(613): Drupal\Core\Entity\EntityBase->save()
#6 /app/webroot/core/includes/install.core.inc(1688): Drupal\Core\Config\Entity\ConfigEntityBase->save()
#7 /app/webroot/core/includes/install.core.inc(1733): install_download_additional_translations_operations(Array)
#8 /app/webroot/core/includes/install.core.inc(631): install_import_translations(Array)
#9 /app/webroot/core/includes/install.core.inc(577): install_run_task(Array, Array)
#10 /app/webroot/core/includes/install.core.inc(118): install_run_tasks(Array, NULL)
#11 /app/vendor/drush/drush/includes/drush.inc(238): install_drupal(Object(Composer\Autoload\ClassLoader), Array)
#12 /app/vendor/drush/drush/includes/drush.inc(223): drush_call_user_func_array('install_drupal', Array)
#13 /app/vendor/drush/drush/src/Commands/core/SiteInstallCommands.php(141): drush_op('install_drupal', Object(Composer\Autoload\ClassLoader), Array)
#14 [internal function]: Drush\Commands\core\SiteInstallCommands->install('minimal', Array)
#15 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array(Array, Array)
#16 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
#17 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(178): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#18 /app/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 /app/vendor/symfony/console/Command/Command.php(255): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#20 /app/vendor/symfony/console/Application.php(971): Symfony\Component\Console\Command\Command->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#21 /app/vendor/symfony/console/Application.php(248): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 /app/vendor/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#23 /app/vendor/drush/drush/src/Runtime/Runtime.php(112): Symfony\Component\Console\Application->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#24 /app/vendor/drush/drush/src/Runtime/Runtime.php(41): Drush\Runtime\Runtime->doRun(Array)
#25 /app/vendor/drush/drush/drush.php(66): Drush\Runtime\Runtime->run(Array)
#26 /app/vendor/drush/drush/includes/preflight.inc(17): require('/app/vendor/dru...')
#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 setWeight() on null in Drupal\language\ConfigurableLanguageManager->updateLockedLanguageWeights() (line 357 of /app/webroot/core/modules/language/src/ConfigurableLanguageManager.php).

Proposed resolution

There is a ConfigurableLanguage::load in the function throwing the error, I think the language is not in the DB yet because site is being installed, I propose to add a condition to check if the language was loaded.

πŸ› Bug report
Status

Closed: outdated

Version

11.0 πŸ”₯

Component
ConfigurationΒ  β†’

Last updated about 17 hours ago

Created by

πŸ‡¨πŸ‡΄Colombia jidrone

Live updates comments and jobs are added and updated live.
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.

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

    This issue is being reviewed by the kind folks in Slack, #needs-review-queue-initiative. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge request β†’ as a guide.

    Wonder if this is still an issue? Have not seen it on D9 or D10 and use configuration import very very often.

    If still an issue the fix will need tests but will hold on tagging that.

  • Status changed to Closed: outdated 5 months ago
  • πŸ‡³πŸ‡ΏNew Zealand quietone

    There has been no discussion here for 5 years, except for a 2 years ago when confirmation that this problem still exists was asked for. There has been no response.

    Therefore, closing. If you are experiencing this problem on a supported version of Drupal reopen the issue, by setting the status to 'Active', and provide complete steps to reproduce the issue β†’ (starting from "Install Drupal core").

    Thanks!

Production build 0.71.5 2024