AssertionError: assert($typed_config instanceof Mapping) in assert()

Created on 21 June 2024, 5 months ago
Updated 2 July 2024, 5 months ago

Problem/Motivation

While trying out latest version of the Drupal 10.3.0, found some issue with lightning_core version 8.x-5.14 config during updb run.

Error:

>  [error]  AssertionError: assert($typed_config instanceof Mapping) in assert() (line 264 of /docroot/core/modules/system/system.post_update.php) #0 /docroot/core/modules/system/system.post_update.php(264): assert(false, 'assert($typed_c...')
> #1 /vendor/drush/drush/src/Commands/core/UpdateDBCommands.php(280): system_post_update_add_langcode_to_all_translatable_config(Array)
> #2 /vendor/drush/drush/includes/batch.inc(257): Drush\Commands\core\UpdateDBCommands::updateDoOnePostUpdate('system_post_upd...', Array)
> #3 /vendor/drush/drush/includes/batch.inc(204): _drush_batch_worker()
> #4 /vendor/drush/drush/includes/batch.inc(75): _drush_batch_command('4480')
> #5 /vendor/drush/drush/src/Commands/core/UpdateDBCommands.php(136): drush_batch_command('4480')
> #6 [internal function]: Drush\Commands\core\UpdateDBCommands->process('4480', Array)
> #7 /vendor/consolidation/annotated-command/src/CommandProcessor.php(276): call_user_func_array(Array, Array)
> #8 /vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
> #9 /vendor/consolidation/annotated-command/src/CommandProcessor.php(175): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
> #10 /vendor/consolidation/annotated-command/src/AnnotatedCommand.php(387): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
> #11 /vendor/symfony/console/Command/Command.php(326): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #12 /vendor/symfony/console/Application.php(1096): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #13 /vendor/symfony/console/Application.php(324): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #14 /vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #15 /vendor/drush/drush/src/Runtime/Runtime.php(110): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #16 /vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
> #17 /vendor/drush/drush/drush.php(139): Drush\Runtime\Runtime->run(Array)
> #18 /vendor/drush/drush/drush(4): require('/...')
> #19 /vendor/bin/drush(120): include('/...')
> #20 {main}. 

Steps to reproduce

1) Update Drupal core to 10.3.0
2) Add and install Lightning Core module with version 8.x-5.14
3) Run drush updb -y

Proposed resolution

I dig down little in the issue of the core module to see where and why the updb execution is keep failing. From the primary investigations, I found that the issue is with config lightning_core.versions.

assert($typed_config instanceof Mapping); function at docroot/core/module/system/system.post_update.php on line no 264, validates that the coming configurations should match the object format of type Drupal\Core\Config\Schema\Mapping but rather coming in same format lightning_core module's lightning_core.versions config having the type of Drupal\Core\Config\Schema\Sequence which could be possbile reason for the failure of the system module's hook update.

To fix this we have to change the config or need some solution for it.

I will appreciate the help in solving this issue, because i need it's solution as soon as possbile.

🐛 Bug report
Status

Active

Version

5.14

Component

Code

Created by

🇮🇳India smitghelani Surat, Gujarat

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

Comments & Activities

  • Issue created by @smitghelani
  • 🇮🇳India smitghelani Surat, Gujarat

    MR is there open to merge by Ilya Novikov : https://git.drupalcode.org/project/lightning_core/-/merge_requests/32
    which is possible fix for this issue

  • 🇮🇳India smitghelani Surat, Gujarat

    patch downloaded from same open MR until latest version comes with changes

  • 🇦🇹Austria kevin.pfeifer

    Can confirm, that this patch fixes the error which happens on `drush updb` in the `system_post_update_add_langcode_to_all_translatable_config` step.

  • 🇧🇷Brazil aluzzardi Pelotas, RS

    I'm facing the same issue on lightning_core 6.0.0 and the patch did not work for me.

  • 🇮🇳India gawalin

    I encountered this issue when I updated Drupal core from 10.2.7 to 10.3.0 and then ran the DB update command.

    > [error] AssertionError: assert($typed_config instanceof Mapping) in assert() (line 264 of C:\xampp-php-8.1\htdocs\drupal10\docroot\core\modules\system\system.post_update.php) #0 C:\xampp-php-8.1\htdocs\drupal10\docroot\core\modules\system\system.post_update.php(264): assert(false, 'assert($typed_c...')
    > #1 C:\xampp-php-8.1\htdocs\drupal10\vendor\drush\drush\src\Commands\core\UpdateDBCommands.php(280): system_post_update_add_langcode_to_all_translatable_config(Array)
    > #2 C:\xampp-php-8.1\htdocs\drupal10\vendor\drush\drush\includes\batch.inc(257): Drush\Commands\core\UpdateDBCommands::updateDoOnePostUpdate('system_post_upd...', Array)
    > #3 C:\xampp-php-8.1\htdocs\drupal10\vendor\drush\drush\includes\batch.inc(204): _drush_batch_worker()
    > #4 C:\xampp-php-8.1\htdocs\drupal10\vendor\drush\drush\includes\batch.inc(75): _drush_batch_command('651')
    > #5 C:\xampp-php-8.1\htdocs\drupal10\vendor\drush\drush\src\Commands\core\UpdateDBCommands.php(136): drush_batch_command('651')
    > #6 [internal function]: Drush\Commands\core\UpdateDBCommands->process('651', Array)
    > #7 C:\xampp-php-8.1\htdocs\drupal10\vendor\consolidation\annotated-command\src\CommandProcessor.php(276): call_user_func_array(Array, Array)
    > #8 C:\xampp-php-8.1\htdocs\drupal10\vendor\consolidation\annotated-command\src\CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
    > #9 C:\xampp-php-8.1\htdocs\drupal10\vendor\consolidation\annotated-command\src\CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
    > #10 C:\xampp-php-8.1\htdocs\drupal10\vendor\consolidation\annotated-command\src\AnnotatedCommand.php(391): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
    > #11 C:\xampp-php-8.1\htdocs\drupal10\vendor\symfony\console\Command\Command.php(326): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    > #12 C:\xampp-php-8.1\htdocs\drupal10\vendor\symfony\console\Application.php(1096): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    > #13 C:\xampp-php-8.1\htdocs\drupal10\vendor\symfony\console\Application.php(324): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    > #14 C:\xampp-php-8.1\htdocs\drupal10\vendor\symfony\console\Application.php(175): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    > #15 C:\xampp-php-8.1\htdocs\drupal10\vendor\drush\drush\src\Runtime\Runtime.php(110): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    > #16 C:\xampp-php-8.1\htdocs\drupal10\vendor\drush\drush\src\Runtime\Runtime.php(40): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
    > #17 C:\xampp-php-8.1\htdocs\drupal10\vendor\drush\drush\drush.php(139): Drush\Runtime\Runtime->run(Array)
    > #18 C:\xampp-php-8.1\htdocs\drupal10\vendor\drush\drush\drush(4): require('C:\\xampp-php-8....')
    > #19 C:\xampp-php-8.1\htdocs\drupal10\vendor\bin\drush(120): include('C:\\xampp-php-8....')
    > #20 {main}.
    > AssertionError: assert($typed_config instanceof Mapping) in C:\xampp-php-8.1\htdocs\drupal10\docroot\core\modules\system\system.post_update.php on line 264 #0 C:\xampp-php-8.1\htdocs\drupal10\docroot\core\modules\system\system.post_update.php(264): assert(false, 'assert($typed_c...')
    > #1 C:\xampp-php-8.1\htdocs\drupal10\vendor\drush\drush\src\Commands\core\UpdateDBCommands.php(280): system_post_update_add_langcode_to_all_translatable_config(Array)
    > #2 C:\xampp-php-8.1\htdocs\drupal10\vendor\drush\drush\includes\batch.inc(257): Drush\Commands\core\UpdateDBCommands::updateDoOnePostUpdate('system_post_upd...', Array)
    > #3 C:\xampp-php-8.1\htdocs\drupal10\vendor\drush\drush\includes\batch.inc(204): _drush_batch_worker()
    > #4 C:\xampp-php-8.1\htdocs\drupal10\vendor\drush\drush\includes\batch.inc(75): _drush_batch_command('651')
    > #5 C:\xampp-php-8.1\htdocs\drupal10\vendor\drush\drush\src\Commands\core\UpdateDBCommands.php(136): drush_batch_command('651')
    > #6 [internal function]: Drush\Commands\core\UpdateDBCommands->process('651', Array)
    > #7 C:\xampp-php-8.1\htdocs\drupal10\vendor\consolidation\annotated-command\src\CommandProcessor.php(276): call_user_func_array(Array, Array)
    > #8 C:\xampp-php-8.1\htdocs\drupal10\vendor\consolidation\annotated-command\src\CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
    > #9 C:\xampp-php-8.1\htdocs\drupal10\vendor\consolidation\annotated-command\src\CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
    > #10 C:\xampp-php-8.1\htdocs\drupal10\vendor\consolidation\annotated-command\src\AnnotatedCommand.php(391): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
    > #11 C:\xampp-php-8.1\htdocs\drupal10\vendor\symfony\console\Command\Command.php(326): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    > #12 C:\xampp-php-8.1\htdocs\drupal10\vendor\symfony\console\Application.php(1096): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    > #13 C:\xampp-php-8.1\htdocs\drupal10\vendor\symfony\console\Application.php(324): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    > #14 C:\xampp-php-8.1\htdocs\drupal10\vendor\symfony\console\Application.php(175): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    > #15 C:\xampp-php-8.1\htdocs\drupal10\vendor\drush\drush\src\Runtime\Runtime.php(110): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    > #16 C:\xampp-php-8.1\htdocs\drupal10\vendor\drush\drush\src\Runtime\Runtime.php(40): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
    > #17 C:\xampp-php-8.1\htdocs\drupal10\vendor\drush\drush\drush.php(139): Drush\Runtime\Runtime->run(Array)
    > #18 C:\xampp-php-8.1\htdocs\drupal10\vendor\drush\drush\drush(4): require('C:\\xampp-php-8....')
    > #19 C:\xampp-php-8.1\htdocs\drupal10\vendor\bin\drush(120): include('C:\\xampp-php-8....')
    > #20 {main}
    > [warning] Drush command terminated abnormally.

    In ProcessBase.php line 171:

    Unable to decode output into JSON: Syntax error

    AssertionError: assert($typed_config instanceof Mapping) in assert() (line 264 of C:\xampp-php-8.1\htdocs\drupal10\docroot\core\
    modules\system\system.post_update.php).

  • 🇮🇳India gawalin

    Refer : https://www.drupal.org/project/drupal/issues/3458431 Improve developer experience for 10.3.x upgrade by informing where typed config fails Needs review

    Thank you!

  • Very strange. Updating from 10.2.7 to 10.3.1 seems to go ok with updb on my local development environment but errors out with the assertionerror on lightnight core versions in the cloud hosting environment. I've tried to apply this patch but it fails.

Production build 0.71.5 2024