Problem/Motivation
We've observed the following error when trying to save a text format, e.g. to add CKEditor buttons.
Not sure when it started, as we haven't needed to edit the formats for a while.
Core 10.3.1
Markdown 3.0.1
This is happening on a format that does not actually use markdown (although we use markdown on a different format, so can't just uninstall the module).
Possibly related to #3449851: Replace LogicException with trigger_error in LangcodeRequiredIfTranslatableValues constraint - we were seeing another error, but got past that with the patch from that issue.
InvalidArgumentException: The configuration property id doesn't exist. in Drupal\Core\Config\Schema\ArrayElement->get() (line 95 of core/lib/Drupal/Core/Config/Schema/ArrayElement.php).
Drupal\Core\Config\Schema\ArrayElement->get('filters.markdown.settings.extensions.commonmark-external-links.id') (Line: 278)
Drupal\Core\Validation\Plugin\Validation\Constraint\ValidKeysConstraintValidator::getDynamicMessageParameters(Object) (Line: 90)
Drupal\Core\Validation\Plugin\Validation\Constraint\ValidKeysConstraintValidator->validate(Array, Object) (Line: 202)
Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateConstraints(Array, '00000000000011c90000000000000000', Array) (Line: 154)
Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateNode(Object) (Line: 164)
Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateNode(Object) (Line: 164)
Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateNode(Object) (Line: 164)
Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateNode(Object) (Line: 164)
Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateNode(Object) (Line: 164)
Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateNode(Object) (Line: 164)
Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateNode(Object, Array, 1) (Line: 106)
Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validate(Object, NULL, NULL) (Line: 93)
Drupal\Core\TypedData\Validation\RecursiveValidator->validate(Object) (Line: 132)
Drupal\Core\TypedData\TypedData->validate() (Line: 234)
Drupal\ckeditor5\Plugin\Editor\CKEditor5::validatePair(Object, Object) (Line: 680)
Drupal\ckeditor5\Plugin\Editor\CKEditor5->validateConfigurationForm(Array, Object) (Line: 207)
editor_form_filter_admin_format_validate(Array, Object)
call_user_func_array('editor_form_filter_admin_format_validate', Array) (Line: 82)
Drupal\Core\Form\FormValidator->executeValidateHandlers(Array, Object) (Line: 274)
Drupal\Core\Form\FormValidator->doValidateForm(Array, Object, 'filter_format_edit_form') (Line: 118)
Drupal\Core\Form\FormValidator->validateForm('filter_format_edit_form', Array, Object) (Line: 593)
Drupal\Core\Form\FormBuilder->processForm('filter_format_edit_form', Array, Object) (Line: 326)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object) (Line: 39)
Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController->getContentResult(Object, Object) (Line: 80)
Drupal\workspaces\Controller\WorkspacesHtmlEntityFormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 638)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 53)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 741)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Steps to reproduce
Workaround
1. delete the markdown filter format: drush cdel filter.format.markdown
2, uninstall the markdown module: drush pmu markdown
3. clear cache: drush cr
4. re-enable markdown: drush en markdown
5. re-create the markdown format
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork markdown-3463119
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
Comment #2
malcomio commentedComment #3
jefflogan commentedI can confirm that I am seeing the same error for a filter format that doesn't have markdown enabled.
Effects 10.3.0 onwards following the addition of the Constraint Validator in Drupal 10.3.
Using Markdown 3.0.1.
So I guess we need to know how do we prevent this from running on filters that don't have this enabled.
Comment #4
malcomio commentedPossibly related to #3409277: SubformState incorrect interface error
Comment #5
jasonawantI'm also experiencing an issue when saving a text format that does not utilize the markdown filter, see #3470570: Unable to save text format without enabling Markdown filter.
Comment #6
malcomio commentedI noticed that the commonmark-external-links plugin is marked as deprecated.
This annotation was committed for #3142418: Support multiple libraries per plugin.
I tried deleting it, and clearing the cache, but got the same error for commonmark-heading-permalink (which isn't marked as deprecated.
Comment #8
alfthecat commentedComment #9
ambient.impactEven after applying the patch from the merge request and clearing caches, I'm still getting the fatal error. Is there a step I'm forgetting to get this to work?
Comment #10
roromedia commentedHi, same here. Whenever I try to save a text filter like Full HTML the error happens. Only possibility is to fully disable the markdown module to get it working again. Unfortunately there is no other module which outputs markdown which you can bring in as markdown_easy conflicts on install with the existing markdown-text filter.
Comment #11
malcomio commentedYes we're also seeing the same error - I don't think the issue should have been set to Needs Review.
Have marked the merge request as draft.
Comment #13
malcomio commentedWith the latest changes in the merge request, this seems to be working as expected.
I think that this may be a side effect of the patch that we're using for #3283349: Add support for Commonmark v2 - the plugins that seem to be causing this problem are all related to CommonMark.
Ideally we'd address the problem that causes these plugins to be missing an id, rather than just deleting them altogether.
Comment #14
malcomio commentedThis change seems to cause problems with existing filters that have markdown enabled.
Comment #15
aasarava commentedBumping this to Critical priority since site it breaks the ability for site admins to edit the site's text formats.
From my testing, it appears that the problem occurs when trying to save a text format that has CKeditor 5 configured as the editor. Markdown does NOT need to be enabled on the format at all. So I'm not sure why the validator is even bothering trying to check the Markdown extensions.
It feels like there's some incompatibility with the way the Markdown extensions are defined, or the way they're validated.
Comment #16
macsim commentedAfter applying the MR34 patch, I was able to save my text format configuration before removing the patch.
I exported the config and got the following diff:
while we should have no diff or:
Comment #17
macsim commentedIt might be because ids are missing in
markdown.schema.ymlWe might have to add something like that to all
markdown.parser_settings.*and maybe alsomarkdown.extension_settings.*.Since this file is only used during the module installation, we should use a
hook_update somehowComment #18
malcomio commentedFor anyone who is having this problem when trying to edit non-markdown formats, there is a workaround:
1. delete the markdown filter format:
drush cdel filter.format.markdown2, uninstall the markdown module:
drush pmu markdown3. clear cache:
drush cr4. re-enable markdown:
drush en markdown5. re-create the markdown format
Comment #22
megachrizIn 3463119-abort-validation I've added code to abort validation of the Markdown settings and also remove the Markdown settings from the form state when the markdown filter is not enabled. In my case, this allows a text format with CKEditor enabled but with Markdown disabled to be saved again.
It does not solve the underlying error, because the reported error message is still there when you both enable CKEditor and Markdown. But it looks like they aren't meant to be enabled together.
This should fix #3470570: Unable to save text format without enabling Markdown filter as well.
Comment #23
norman.lolWith MR34 and running
drush generate phpstorm-metato get a nice mapping file for PhpStorm autocompletion, I get the following error, as these plugins are still referenced in code:Comment #24
norman.lolIs MR44 another approach to solve the same problem?
Comment #25
robloach> Is MR44 another approach to solve the same problem?
It looks like that's some tests. Doesn't solve the problem.
Comment #26
robloachI think MR47 fixed this for me. Nice work. Was able to configure things without issue.
Comment #28
joelpittetThanks for RTBCing this I have committed MR47 to the 3.0.x-dev
Comment #29
joelpittet