Problem/Motivation

I'm receiving this error on 10.3.0 and latest CKEditor IndentBlock

Symfony\Component\Validator\Exception\LogicException: The LangcodeRequiredIfTranslatableValues constraint can only operate on the root object being validated. in Drupal\Core\Config\Plugin\Validation\Constraint\LangcodeRequiredIfTranslatableValuesConstraintValidator->validate() (line 26 of /code/web/core/lib/Drupal/Core/Config/Plugin/Validation/Constraint/LangcodeRequiredIfTranslatableValuesConstraintValidator.php).

Full Stack Trace

#0 /code/web/core/lib/Drupal/Core/TypedData/Validation/RecursiveContextualValidator.php(202): Drupal\Core\Config\Plugin\Validation\Constraint\LangcodeRequiredIfTranslatableValuesConstraintValidator->validate(Array, Object(Drupal\Core\Config\Plugin\Validation\Constraint\LangcodeRequiredIfTranslatableValuesConstraint))
#1 /code/web/core/lib/Drupal/Core/TypedData/Validation/RecursiveContextualValidator.php(154): Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateConstraints(Array, '000000000000088...', Array)
#2 /code/web/core/lib/Drupal/Core/TypedData/Validation/RecursiveContextualValidator.php(164): Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateNode(Object(Drupal\Core\Config\Schema\Mapping))
#3 /code/web/core/lib/Drupal/Core/TypedData/Validation/RecursiveContextualValidator.php(164): Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateNode(Object(Drupal\Core\Config\Schema\Sequence))
#4 /code/web/core/lib/Drupal/Core/TypedData/Validation/RecursiveContextualValidator.php(164): Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateNode(Object(Drupal\Core\Config\Schema\Mapping))
#5 /code/web/core/lib/Drupal/Core/TypedData/Validation/RecursiveContextualValidator.php(106): Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateNode(Object(Drupal\Core\Config\Schema\Mapping), Array, true)
#6 /code/web/core/lib/Drupal/Core/TypedData/Validation/RecursiveValidator.php(93): Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validate(Object(Drupal\Core\Config\Schema\Mapping), NULL, NULL)
#7 /code/web/core/lib/Drupal/Core/TypedData/TypedData.php(132): Drupal\Core\TypedData\Validation\RecursiveValidator->validate(Object(Drupal\Core\Config\Schema\Mapping))
#8 /code/web/core/modules/ckeditor5/src/Plugin/Editor/CKEditor5.php(234): Drupal\Core\TypedData\TypedData->validate()
#9 /code/web/core/modules/ckeditor5/src/Plugin/Editor/CKEditor5.php(680): Drupal\ckeditor5\Plugin\Editor\CKEditor5::validatePair(Object(Drupal\editor\Entity\Editor), Object(Drupal\filter\Entity\FilterFormat))
#10 /code/web/core/modules/editor/editor.module(207): Drupal\ckeditor5\Plugin\Editor\CKEditor5->validateConfigurationForm(Array, Object(Drupal\Core\Form\SubformState))
#11 [internal function]: editor_form_filter_admin_format_validate(Array, Object(Drupal\Core\Form\FormState))
#12 /code/web/core/lib/Drupal/Core/Form/FormValidator.php(82): call_user_func_array('editor_form_fil...', Array)
#13 /code/web/core/lib/Drupal/Core/Form/FormValidator.php(274): Drupal\Core\Form\FormValidator->executeValidateHandlers(Array, Object(Drupal\Core\Form\FormState))
#14 /code/web/core/lib/Drupal/Core/Form/FormValidator.php(118): Drupal\Core\Form\FormValidator->doValidateForm(Array, Object(Drupal\Core\Form\FormState), 'filter_format_e...')
#15 /code/web/core/lib/Drupal/Core/Form/FormBuilder.php(593): Drupal\Core\Form\FormValidator->validateForm('filter_format_e...', Array, Object(Drupal\Core\Form\FormState))
#16 /code/web/core/lib/Drupal/Core/Form/FormBuilder.php(326): Drupal\Core\Form\FormBuilder->processForm('filter_format_e...', Array, Object(Drupal\Core\Form\FormState))
#17 /code/web/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm(Object(Drupal\filter\FilterFormatEditForm), Object(Drupal\Core\Form\FormState))
#18 [internal function]: Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch))
#19 /code/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#20 /code/web/core/lib/Drupal/Core/Render/Renderer.php(638): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#21 /code/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(121): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#22 /code/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#23 /code/vendor/symfony/http-kernel/HttpKernel.php(181): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#24 /code/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#25 /code/web/modules/contrib/simple_oauth/src/HttpMiddleware/BasicAuthSwap.php(68): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#26 /code/web/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Drupal\simple_oauth\HttpMiddleware\BasicAuthSwap->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#27 /code/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#28 /code/web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#29 /code/web/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#30 /code/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#31 /code/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#32 /code/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#33 /code/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#34 /code/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#35 /code/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#36 /code/web/core/lib/Drupal/Core/DrupalKernel.php(741): Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#37 /code/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#38 {main}

Steps to reproduce

Trying to save form on the following text editor settings page:

/admin/config/content/formats/manage/basic_html

Proposed resolution

Don't throw a fatal error but point out what config is wrong

Remaining tasks

User interface changes

API changes

Data model changes

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

cbwiedel created an issue. See original summary.

cbwiedel’s picture

Title: Symfony\Component\Validator\Exception\LogicException: The LangcodeRequiredIfTranslatableValues constraint can only operate on the root object being validated » Symfony\Component\Validator\Exception\LogicException: The LangcodeRequiredIfTranslatableValues constraint can only operate on the root object being validated.
ryan-l-robinson’s picture

I have the same error since updating to Drupal 10.3. Through trial and error of uninstalling one ckeditor-adjacent module at a time, I found I needed to uninstall both ckeditor_indentblock and ckeditor_codemirror to get the error to go away, so I logged the same issue there: https://www.drupal.org/project/ckeditor_codemirror/issues/3457347.

glenshewchuck’s picture

We are having the same error and the patch in this issued solved it for now. https://www.drupal.org/project/drupal/issues/3449851

alexpott’s picture

This is happening because this module's config schema is incorrect.

https://git.drupalcode.org/project/ckeditor_indentblock/-/blame/8.x-1.x/... should be mapping or something other than a config_object.

Looking at core you see mapping for ckeditor plugins

# Plugin \Drupal\ckeditor5\Plugin\CKEditor5Plugin\SourceEditing
ckeditor5.plugin.ckeditor5_sourceEditing:
  type: mapping

I guess it is the same for ckeditor_codemirror

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

alexpott’s picture

Status: Active » Needs review
jonasanne’s picture

I have tested the MR and I can confirm this resolves the problem and the error is gone.

ryan-l-robinson’s picture

The proposed change fixes the problem for me.

giordy’s picture

I also have this problem, but only in one of my two sites, with the Linkit and Editor Advanced Link modules.

On Linkit (which doesn't work properly), if I select Linkit URL converter and save, the site tells me:
The website encountered an unexpected error. Try again later. and I have the error in question.
Even on Editor Advanced Link, if I change the settings I get the same error.
If I deactivate codemirror the problem is solved (but Linkit still doesn't work).
When I try to reinstall codemirror, the site crashes again, but still manages to save itself.

vincent.hoehn’s picture

Status: Needs review » Reviewed & tested by the community

I can confirm that this resolves the problem.

justcaldwell’s picture

Also confirming the changes from the MR resolve the issue. Static patch attached to ease testing.

+1 to RTBC!

trackleft2’s picture

+1 to RTBC!

arthurg’s picture

The correction is in the new version or not ?

trackleft2’s picture

@arthurg we're waiting on this to be merged, after that, there will need to be a new release of the module.

If you want this fix to be on your site right now there are many many ways to accomplish that, here is one of the better ways: https://www.drupal.org/docs/develop/using-composer/manage-dependencies#p...

You can automatically apply patches to composer-built dependencies using cweagans/composer-patches. See the project's README.md file for specific instructions.

Hopefully I understood what you were asking.

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

heddn’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for your contributions.

  • heddn committed 6f3d007c on 8.x-1.x authored by alexpott
    Issue #3457094 by alexpott, heddn: Symfony\Component\Validator\Exception...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.