InvalidArgumentException: Field default_langcode is unknown.

Created on 7 May 2024, 7 months ago
Updated 8 May 2024, 7 months ago

Problem/Motivation

We completed a composer update. Now no webforms are working with on screen error "The website encountered an unexpected error. Try again later." and php error message "InvalidArgumentException: Field default_langcode is unknown. in Drupal\Core\Entity\ContentEntityBase->getTranslatedField() (line 616 of /drupal/web/core/lib/Drupal/Core/Entity/ContentEntityBase.php)."

๐Ÿ› Bug report
Status

Closed: works as designed

Version

6.2

Component

Code

Created by

๐Ÿ‡บ๐Ÿ‡ธUnited States crutch

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

Comments & Activities

  • Issue created by @crutch
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States crutch

    Downgrading to Drupal 10.2.4 and using webform 6.2.1 or 6.2.2 seems to have fixed this in development. There seems to be an introduction of requiring a default_langcode in core that causes an issue with webform.

    Even after installing Configuration Translation and related modules in Drupal 10.2.5 or 10.2.6, no webforms are accessible.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States crutch

    Production has both drupal 10.2.4 and webfrom 6.2.2 but still broken with "invalidArgumentException: Field default_langcode is unknown"

    The only difference is in development we restored a database from when it was 10.2.4 and it's working but we can't do that on production.

  • Status changed to Postponed: needs info 7 months ago
  • Are any patches installed? Can you please get the stack trace? Can you search the code base for โ€œdefault_langcodeโ€ and report back?

  • ๐Ÿ‡ฏ๐Ÿ‡ตJapan ilfelice

    Howdy,

    Even after installing Configuration Translation and related modules in Drupal 10.2.5 or 10.2.6, no webforms are accessible. There was no issue with webform configuration, just when viewing the form equals wsod.

    Running Webform 6.2.2 on recently update Drupal core 10.2.5 here, and webforms are working OK.

    This is a Japanese site, with more than 7 very different webforms, and none of them show the problem reported here.

    Reporting this FWIW.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States crutch

    #4 will do today, just starting, thank you #4 and 5.

    Replicated production on a clean dev. They are currently on D10.2.4 and webform 6.2.2. Installed Configuration Translation, Interface Translation, Language and Locale. Visit webform/configuration/translate

    Warning message
    In order to translate configuration, the website must have at least two languages.

    Added a 2nd language

    Visit webform/configuration/translate and seems fine

    Visit webform/configuration/advanced and repair configuration

    Flush cache

    Visit a form, same error

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States crutch

    "default_langcode" locations

    webform.install.inc
    \modules\contrib\webform\includes

    content_translation.admin.inc
    \core\modules\content_translation

    install.core.inc
    \core\includes

    install.inc
    \core\includes

    update.fetch.inc
    \core\modules\update

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States crutch

    #0 C:\xampp\htdocs\web\core\lib\Drupal\Core\Entity\ContentEntityBase.php(597): Drupal\Core\Entity\ContentEntityBase->getTranslatedField('default_langcod...', 'x-default')
    #1 C:\xampp\htdocs\web\modules\contrib\multiple_select\multiple_select.module(51): Drupal\Core\Entity\ContentEntityBase->get('default_langcod...')
    #2 C:\xampp\htdocs\web\modules\contrib\multiple_select\multiple_select.module(36): multiple_select(Array, Object(Drupal\Core\Form\FormState), 'webform_submiss...')
    #3 C:\xampp\htdocs\web\core\lib\Drupal\Core\Extension\ModuleHandler.php(545): multiple_select_form_alter(Array, Object(Drupal\Core\Form\FormState), 'webform_submiss...')
    #4 C:\xampp\htdocs\web\core\lib\Drupal\Core\Form\FormBuilder.php(841): Drupal\Core\Extension\ModuleHandler->alter('form', Array, Object(Drupal\Core\Form\FormState), 'webform_submiss...')
    #5 C:\xampp\htdocs\web\core\lib\Drupal\Core\Form\FormBuilder.php(284): Drupal\Core\Form\FormBuilder->prepareForm('webform_submiss...', Array, Object(Drupal\Core\Form\FormState))
    #6 C:\xampp\htdocs\web\core\lib\Drupal\Core\Entity\EntityFormBuilder.php(48): Drupal\Core\Form\FormBuilder->buildForm(Object(Drupal\webform\WebformSubmissionForm), Object(Drupal\Core\Form\FormState))
    #7 C:\xampp\htdocs\web\modules\contrib\webform\src\Entity\Webform.php(1257): Drupal\Core\Entity\EntityFormBuilder->getForm(Object(Drupal\webform\Entity\WebformSubmission), 'add')
    #8 C:\xampp\htdocs\web\modules\contrib\webform\src\Controller\WebformEntityController.php(77): Drupal\webform\Entity\Webform->getSubmissionForm()
    #9 [internal function]: Drupal\webform\Controller\WebformEntityController->addForm(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\webform\Entity\Webform))
    #10 C:\xampp\htdocs\web\core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
    #11 C:\xampp\htdocs\web\core\lib\Drupal\Core\Render\Renderer.php(627): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
    #12 C:\xampp\htdocs\web\core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
    #13 C:\xampp\htdocs\web\core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
    #14 C:\xampp\htdocs\vendor\symfony\http-kernel\HttpKernel.php(181): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
    #15 C:\xampp\htdocs\vendor\symfony\http-kernel\HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
    #16 C:\xampp\htdocs\web\core\lib\Drupal\Core\StackMiddleware\Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #17 C:\xampp\htdocs\web\core\lib\Drupal\Core\StackMiddleware\KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #18 C:\xampp\htdocs\web\core\lib\Drupal\Core\StackMiddleware\ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #19 C:\xampp\htdocs\web\core\modules\page_cache\src\StackMiddleware\PageCache.php(106): Drupal\Core\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #20 C:\xampp\htdocs\web\core\modules\page_cache\src\StackMiddleware\PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #21 C:\xampp\htdocs\web\core\modules\ban\src\BanMiddleware.php(50): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #22 C:\xampp\htdocs\web\core\lib\Drupal\Core\StackMiddleware\ReverseProxyMiddleware.php(48): Drupal\ban\BanMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #23 C:\xampp\htdocs\web\core\lib\Drupal\Core\StackMiddleware\NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #24 C:\xampp\htdocs\web\core\lib\Drupal\Core\StackMiddleware\AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #25 C:\xampp\htdocs\web\core\lib\Drupal\Core\StackMiddleware\StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #26 C:\xampp\htdocs\web\core\lib\Drupal\Core\DrupalKernel.php(704): Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #27 C:\xampp\htdocs\web\index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
    #28 {main}

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States crutch

    Ah, I think I see in the backtrace, multiple_select module is involved and it was recently added and also needed a patch.

    "drupal/multiple_select": {
    "Compatibility with module Field Group 8.x-3.4": " https://www.drupal.org/files/issues/2023-06-26/multiple_select-compatibi... โ†’ "
    },

    This is the issue. After uninstalling that module, webform is back to normal. Sorry for the trouble here, will close and post reference to here at multiple_select.

    Thank you

  • Status changed to Closed: works as designed 7 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States crutch
Production build 0.71.5 2024