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

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

malcomio created an issue. See original summary.

malcomio’s picture

Issue summary: View changes
jefflogan’s picture

I 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.

malcomio’s picture

jasonawant’s picture

I'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.

malcomio’s picture

I 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.

alfthecat’s picture

Status: Active » Needs review
ambient.impact’s picture

Even 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?

roromedia’s picture

Hi, 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.

malcomio’s picture

Status: Needs review » Needs work

Yes 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.

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

malcomio’s picture

With 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.

malcomio’s picture

Status: Needs review » Needs work

This change seems to cause problems with existing filters that have markdown enabled.

aasarava’s picture

Priority: Normal » Critical

Bumping 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.

macsim’s picture

After 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:

+  markdown:
+    id: filter_null
+    provider: filter
+    status: false
+    weight: -15
+    settings: {  }

while we should have no diff or:

+  markdown:
+    id: markdown
+    provider: markdown
+    status: false
+    weight: -15
+    settings: {  }
macsim’s picture

It might be because ids are missing in markdown.schema.yml

filter_settings.markdown:
  type: markdown.parser
  mapping:
+   id:
+     type: string
+     label: 'Filter ID'
    override:
      type: boolean
      label: 'Override'

We might have to add something like that to all markdown.parser_settings.* and maybe also markdown.extension_settings.*.

Since this file is only used during the module installation, we should use a hook_update somehow

malcomio’s picture

Issue summary: View changes

For 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.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

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

megachriz’s picture

Status: Needs work » Needs review

In 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.

norman.lol’s picture

With MR34 and running drush generate phpstorm-meta to get a nice mapping file for PhpStorm autocompletion, I get the following error, as these plugins are still referenced in code:

Welcome to phpstorm-meta generator!
–––––––––––––––––––––––––––––––––––––

In ExtensionManager.php line 78:

Plugin ID 'commonmark-heading-permalink' was not found.

phpstorm-meta [-d|--working-dir [WORKING-DIR]] [-a|--answer [ANSWER]] [--dry-run] [--full-path] [--destination [DESTINATION]] [--replace]

Failed to run drush generate phpstorm-meta: exit status 1

norman.lol’s picture

Is MR44 another approach to solve the same problem?

robloach’s picture

> Is MR44 another approach to solve the same problem?

It looks like that's some tests. Doesn't solve the problem.

robloach’s picture

Status: Needs review » Reviewed & tested by the community

I think MR47 fixed this for me. Nice work. Was able to configure things without issue.

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

joelpittet’s picture

Thanks for RTBCing this I have committed MR47 to the 3.0.x-dev

joelpittet’s picture

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • joelpittet committed a73937d1 on 3.0.x authored by megachriz
    feat: #3463119 Error when saving text format - configuration property id...

Status: Fixed » Closed (fixed)

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