Error: Class name must be a valid object or a string

Created on 27 July 2024, 5 months ago
Updated 7 September 2024, 4 months ago

Problem/Motivation

During normal update -W via Composer I'm receiving the following...

Does anyone have some insight into what is happening here?

The update process was aborted prematurely while running update # in system_post_update_add_langcode_to_all_translatable_config.module. All errors have been logged. You may need to check the watchdog database table manually.

Error: Class name must be a valid object or a string in Drupal\Core\TypedData\TypedDataManager->createInstance() (line 99 of /html/core/lib/Drupal/Core/TypedData/TypedDataManager.php)

#0 /html/core/lib/Drupal/Core/TypedData/TypedDataManager.php(108): Drupal\Core\TypedData\TypedDataManager->createInstance()
#1 /html/core/lib/Drupal/Core/Config/Schema/ArrayElement.php(155): Drupal\Core\TypedData\TypedDataManager->create()
#2 /html/core/lib/Drupal/Core/Config/Schema/ArrayElement.php(57): Drupal\Core\Config\Schema\ArrayElement->createElement()
#3 /html/core/lib/Drupal/Core/Config/Schema/ArrayElement.php(104): Drupal\Core\Config\Schema\ArrayElement->parse()
#4 /html/core/lib/Drupal/Core/Config/Schema/ArrayElement.php(138): Drupal\Core\Config\Schema\ArrayElement->getElements()
#5 /html/core/lib/Drupal/Core/Config/Schema/ArrayElement.php(24): Drupal\Core\Config\Schema\ArrayElement->getIterator()
#6 /html/core/modules/system/system.post_update.php(270): Drupal\Core\Config\Schema\ArrayElement->hasTranslatableElements()
#7 /html/core/includes/update.inc(236): system_post_update_add_langcode_to_all_translatable_config()
#8 /html/core/includes/batch.inc(296): update_invoke_post_update()
#9 /html/core/includes/batch.inc(138): _batch_process()
#10 /html/core/includes/batch.inc(94): _batch_do()
#11 /html/core/modules/system/src/Controller/DbUpdateController.php(195): _batch_page()
#12 [internal function]: Drupal\system\Controller\DbUpdateController->handle()
#13 /html/core/lib/Drupal/Core/Update/UpdateKernel.php(115): call_user_func_array()
#14 /html/core/lib/Drupal/Core/Update/UpdateKernel.php(76): Drupal\Core\Update\UpdateKernel->handleRaw()
#15 /html/update.php(27): Drupal\Core\Update\UpdateKernel->handle()
#16 {main}

-----------------------

Warning: Undefined array key 1 in Drupal\system\Controller\DbUpdateController->results() (line 432 of /html/core/modules/system/src/Controller/DbUpdateController.php)

#0 /html/core/includes/bootstrap.inc(166): _drupal_error_handler_real()
#1 /html/core/modules/system/src/Controller/DbUpdateController.php(432): _drupal_error_handler()
#2 /html/core/modules/system/src/Controller/DbUpdateController.php(188): Drupal\system\Controller\DbUpdateController->results()
#3 [internal function]: Drupal\system\Controller\DbUpdateController->handle()
#4 /html/core/lib/Drupal/Core/Update/UpdateKernel.php(115): call_user_func_array()
#5 /html/core/lib/Drupal/Core/Update/UpdateKernel.php(76): Drupal\Core\Update\UpdateKernel->handleRaw()
#6 /html/update.php(27): Drupal\Core\Update\UpdateKernel->handle()
#7 {main}

πŸ’¬ Support request
Status

Closed: cannot reproduce

Version

2.1

Component

Miscellaneous

Created by

πŸ‡ΊπŸ‡ΈUnited States joshuautley

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

Comments & Activities

  • Issue created by @joshuautley
  • Status changed to Postponed: needs info 5 months ago
  • πŸ‡ΊπŸ‡ΈUnited States tr Cascadia

    Why do you think it has anything to do with this module? None of your error messages refer to any code in this module, and the failure occurred when updating the system module which is part of Drupal core ...

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

    Hi TR,

    I'm admittedly grasping at straws.

    I saw "TypedData" and Google sent me here.

    I'm familiar with your work on Ubercart.

    Please point me in a different direction and I'll go there.

    - cheers

  • πŸ‡ΊπŸ‡ΈUnited States tr Cascadia

    What I see is that the failure happened somewhere when running system.post_update.php, which is part of the Drupal core "system" module. And in particular, it failed while running the function system_post_update_add_langcode_to_all_translatable_config() that is found in system.post_update.php

    The classes like \Drupal\Core\TypedData\TypedDataManager that show up in the error messages are all part of the \Drupal\Core namespace, which means they are part of core Drupal. You can tell that by the \Drupal\Core part of the name.

    If those classes where the failure occurred were part of the typed_data module, they would be named beginning with \Drupal\typed_data.

    The system_post_update_add_langcode_to_all_translatable_config() update function was added by πŸ› Require `langcode: …` only for simple config that contains translatable values Active . Because that issue is still open and seems to have caused some problems, I would start by commenting in that issue and posting your error. You can link to this issue too. The people who worked on that issue might have a better idea of what is happening here.

    It would also be useful to add what version of core you were updating from and what version you were updating to. If composer is also updating other modules in the process, it would be useful to mention which modules were listed as being updated - your composer output would show this.

    Also, did you check the watchdog to see if the errors are logged like it said?

  • Status changed to Closed: cannot reproduce 4 months ago
  • πŸ‡ΊπŸ‡ΈUnited States tr Cascadia
  • πŸ‡ΊπŸ‡ΈUnited States robertmartin1961

    I have encountered the error identified by this tread, with the following stack trace:

    > > [error] Error: Class name must be a valid object or a string in Drupal\Core\TypedData\TypedDataManager->createInstance() (line 99 of /var/www/html/sunraz-dev/web/core/lib/Drupal/Core/TypedData/TypedDataManager.php) #0 /var/www/html/sunraz-dev/web/core/lib/Drupal/Core/TypedData/TypedDataManager.php(108): Drupal\Core\TypedData\TypedDataManager->createInstance()
    > > #1 /var/www/html/sunraz-dev/web/core/lib/Drupal/Core/Config/Schema/ArrayElement.php(155): Drupal\Core\TypedData\TypedDataManager->create()
    > > #2 /var/www/html/sunraz-dev/web/core/lib/Drupal/Core/Config/Schema/ArrayElement.php(57): Drupal\Core\Config\Schema\ArrayElement->createElement()
    > > #3 /var/www/html/sunraz-dev/web/core/lib/Drupal/Core/Config/Schema/ArrayElement.php(104): Drupal\Core\Config\Schema\ArrayElement->parse()
    > > #4 /var/www/html/sunraz-dev/web/core/lib/Drupal/Core/Config/Schema/ArrayElement.php(138): Drupal\Core\Config\Schema\ArrayElement->getElements()
    > > #5 /var/www/html/sunraz-dev/web/core/modules/locale/src/LocaleConfigManager.php(166): Drupal\Core\Config\Schema\ArrayElement->getIterator()
    > > #6 /var/www/html/sunraz-dev/web/core/modules/locale/src/LocaleConfigManager.php(145): Drupal\locale\LocaleConfigManager->getTranslatableData()
    > > #7 /var/www/html/sunraz-dev/web/core/modules/locale/src/LocaleConfigManager.php(569): Drupal\locale\LocaleConfigManager->getTranslatableDefaultConfig()
    > > #8 /var/www/html/sunraz-dev/web/core/modules/locale/locale.bulk.inc(639): Drupal\locale\LocaleConfigManager->updateConfigTranslations()
    > > #9 [internal function]: locale_config_batch_refresh_name()
    > > #10 /var/www/html/sunraz-dev/vendor/drush/drush/includes/batch.inc(257): call_user_func_array()
    > > #11 /var/www/html/sunraz-dev/vendor/drush/drush/includes/batch.inc(204): _drush_batch_worker()
    > > #12 /var/www/html/sunraz-dev/vendor/drush/drush/includes/batch.inc(75): _drush_batch_command()
    > > #13 /var/www/html/sunraz-dev/vendor/drush/drush/src/Commands/core/BatchCommands.php(25): drush_batch_command()
    > > #14 [internal function]: Drush\Commands\core\BatchCommands->process()
    > > #15 /var/www/html/sunraz-dev/vendor/consolidation/annotated-command/src/CommandProcessor.php(276): call_user_func_array()
    > > #16 /var/www/html/sunraz-dev/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback()
    > > #17 /var/www/html/sunraz-dev/vendor/consolidation/annotated-command/src/CommandProcessor.php(175): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter()
    > > #18 /var/www/html/sunraz-dev/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(387): Consolidation\AnnotatedCommand\CommandProcessor->process()
    > > #19 /var/www/html/sunraz-dev/vendor/symfony/console/Command/Command.php(326): Consolidation\AnnotatedCommand\AnnotatedCommand->execute()
    > > #20 /var/www/html/sunraz-dev/vendor/symfony/console/Application.php(1096): Symfony\Component\Console\Command\Command->run()
    > > #21 /var/www/html/sunraz-dev/vendor/symfony/console/Application.php(324): Symfony\Component\Console\Application->doRunCommand()
    > > #22 /var/www/html/sunraz-dev/vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun()
    > > #23 /var/www/html/sunraz-dev/vendor/drush/drush/src/Runtime/Runtime.php(110): Symfony\Component\Console\Application->run()
    > > #24 /var/www/html/sunraz-dev/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun()
    > > #25 /var/www/html/sunraz-dev/vendor/drush/drush/drush.php(139): Drush\Runtime\Runtime->run()
    > > #26 /var/www/html/sunraz-dev/vendor/drush/drush/drush(4): require('...')
    > > #27 /var/www/html/sunraz-dev/vendor/bin/drush(119): include('...')
    > > #28 {main}.

    I am running Drupal version 10.3.6. My immediate solution is to disable Typed Data version 2.1.1 and dependent modules.

  • πŸ‡ΊπŸ‡ΈUnited States tr Cascadia

    Again, same question as #2 - why do you think this has anything to do with this (contributed) typed data module?

    All of the errors refer to the *core Drupal* TypedData classes.

    It looks like one of the hook_update functions that you ran has a problem. I don't know which one, but my first guess from looking at your trace is the Locale module. Which is part of core Drupal.

    But this (contributed) typed data module doesn't have *any* update hooks, so it was not failing in this module's update hook.

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

    Thanks TR for the reply. It was not readily apparent to me that this was a core module problem, but I now see it trace locates it in the core directory.

Production build 0.71.5 2024