Problem/Motivation
When I enable "Styles" in a CKEditor configuration I get a fatal error:
AssertionError: assert(NestedArray::keyExists($subform, $parts)) in assert() (line 886 of core/modules/ckeditor5/src/Plugin/Editor/CKEditor5.php).
Drupal\ckeditor5\Plugin\Editor\CKEditor5::mapViolationPropertyPathsToFormNames('settings.plugins.ckeditor5_style.styles', Array) (Line: 922)
Drupal\ckeditor5\Plugin\Editor\CKEditor5::mapPairViolationPropertyPathsToFormNames('settings.plugins.ckeditor5_style.styles', Array) (Line: 707)
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)
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: 116)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 90)
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)
require('/Users/lluisandreu/Projects/drupal/miia-drupal/web/index.php') (Line: 48)
Steps to reproduce
- Ensure that PHP assertions are turned on
- Use "Basic HTML" text format with CKEditor 5.
- Enable "Styles" dragging the button to the toolbar
- Add any style, for example a.test|Test
- Immediately hit Save configuration button before the processing indicator vanished.
- Crash happens and I am unable to add styles.
| Comment | File | Size | Author |
|---|---|---|---|
| #18 | ckeditor5-style.png | 52.26 KB | ishani patel |
| #15 | Styles (select) disabled in CKEditor.png | 13.19 KB | cadence96 |
| #5 | Stylespluginadded.png | 29.1 KB | anjaliprasannan |
| Screenshot 2025-01-16 at 07.15.03.png | 147.72 KB | lluisandreu |
Issue fork drupal-3500153
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 #3
quietone commentedChanges are made on on 11.x (our main development branch) first, and are then back ported as needed according to the Core change policies.
I tested on a fresh install of 11.x HEAD, using the steps in the issue summary and did not get an error.
Comment #4
cilefen commentedInformation in comment #3 suggests there are additional steps to reproduce.
Comment #5
anjaliprasannan commentedI have updated the drupal version now 11.x and with this the issue does not exist.
Steps I followed as per the description:
The configuration gets saved.
The fatal error that appeared before is not shown.
Screenshot

Moving to RTBC.
Comment #6
lluisandreu commentedI tried the same steps in another environment and it does work as expected, this error only happens to me in local. I will update the status to "closed".
Thanks everybody for testing.
Comment #7
lluisandreu commentedComment #8
walker.45 commentedI'm getting the same error when enabling Styles in CKE5 and Drupal 10.4.3.
When I drag the Style button to the active toolbar, the Manually editable HTML tags box in the Source editing settings goes red. I don't get Style settings.
Upon saving, I get the error:
The website encountered an unexpected error. Try again later.
AssertionError: assert(NestedArray::keyExists($subform, $parts)) in assert() (line 886 of core/modules/ckeditor5/src/Plugin/Editor/CKEditor5.php).
Backtrace:
#0 /var/src/web/core/modules/ckeditor5/src/Plugin/Editor/CKEditor5.php(886): assert(false, 'assert(NestedAr...')
#1 /var/src/web/core/modules/ckeditor5/src/Plugin/Editor/CKEditor5.php(922): Drupal\ckeditor5\Plugin\Editor\CKEditor5::mapViolationPropertyPathsToFormNames('settings.plugin...', Array)
#2 /var/src/web/core/modules/ckeditor5/src/Plugin/Editor/CKEditor5.php(707): Drupal\ckeditor5\Plugin\Editor\CKEditor5::mapPairViolationPropertyPathsToFormNames('settings.plugin...', Array)
#3 /var/src/web/core/modules/editor/editor.module(207): Drupal\ckeditor5\Plugin\Editor\CKEditor5->validateConfigurationForm(Array, Object(Drupal\Core\Form\SubformState))
#4 [internal function]: editor_form_filter_admin_format_validate(Array, Object(Drupal\Core\Form\FormState))
#5 /var/src/web/core/lib/Drupal/Core/Form/FormValidator.php(82): call_user_func_array('editor_form_fil...', Array)
#6 /var/src/web/core/lib/Drupal/Core/Form/FormValidator.php(274): Drupal\Core\Form\FormValidator->executeValidateHandlers(Array, Object(Drupal\Core\Form\FormState))
#7 /var/src/web/core/lib/Drupal/Core/Form/FormValidator.php(118): Drupal\Core\Form\FormValidator->doValidateForm(Array, Object(Drupal\Core\Form\FormState), 'filter_format_e...')
#8 /var/src/web/core/lib/Drupal/Core/Form/FormBuilder.php(593): Drupal\Core\Form\FormValidator->validateForm('filter_format_e...', Array, Object(Drupal\Core\Form\FormState))
#9 /var/src/web/core/lib/Drupal/Core/Form/FormBuilder.php(326): Drupal\Core\Form\FormBuilder->processForm('filter_format_e...', Array, Object(Drupal\Core\Form\FormState))
#10 /var/src/web/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm(Object(Drupal\filter\FilterFormatEditForm), Object(Drupal\Core\Form\FormState))
#11 /var/src/web/core/modules/layout_builder/src/Controller/LayoutBuilderHtmlEntityFormController.php(39): Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch))
#12 [internal function]: Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch))
#13 /var/src/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#14 /var/src/web/core/lib/Drupal/Core/Render/Renderer.php(638): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#15 /var/src/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#16 /var/src/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#17 /var/src/vendor/symfony/http-kernel/HttpKernel.php(181): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#18 /var/src/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#19 /var/src/web/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#20 /var/src/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#21 /var/src/web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#22 /var/src/web/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#23 /var/src/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(116): Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#24 /var/src/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(90): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#25 /var/src/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#26 /var/src/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#27 /var/src/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#28 /var/src/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#29 /var/src/web/core/lib/Drupal/Core/DrupalKernel.php(741): Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#30 /var/src/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#31 {main}
Comment #9
kenrbnsn commentedI get this error when trying to add styles. I'm on Drupal 11.1.4 (local ddev instance)
The website encountered an unexpected error. Try again later.
AssertionError: assert(NestedArray::keyExists($subform, $parts)) in assert() (line 857 of core/modules/ckeditor5/src/Plugin/Editor/CKEditor5.php).
Drupal\ckeditor5\Plugin\Editor\CKEditor5::mapViolationPropertyPathsToFormNames() (Line: 893)
Drupal\ckeditor5\Plugin\Editor\CKEditor5::mapPairViolationPropertyPathsToFormNames() (Line: 678)
Drupal\ckeditor5\Plugin\Editor\CKEditor5->validateConfigurationForm() (Line: 59)
editor_form_filter_admin_format_validate()
call_user_func_array() (Line: 82)
Drupal\Core\Form\FormValidator->executeValidateHandlers() (Line: 274)
Drupal\Core\Form\FormValidator->doValidateForm() (Line: 118)
Drupal\Core\Form\FormValidator->validateForm() (Line: 585)
Drupal\Core\Form\FormBuilder->processForm() (Line: 321)
Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)
Drupal\Core\Controller\FormController->getContentResult()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 593)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 183)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 116)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 90)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 709)
Drupal\Core\DrupalKernel->handle() (Line: 19)
I tried updating to v11.2-dev and get the same error. I get the error when trying to save the "Style" contents.
AssertionError: assert(NestedArray::keyExists($subform, $parts)) in assert() (line 857 of core/modules/ckeditor5/src/Plugin/Editor/CKEditor5.php).
Drupal\ckeditor5\Plugin\Editor\CKEditor5::mapViolationPropertyPathsToFormNames() (Line: 893)
Drupal\ckeditor5\Plugin\Editor\CKEditor5::mapPairViolationPropertyPathsToFormNames() (Line: 678)
Drupal\ckeditor5\Plugin\Editor\CKEditor5->validateConfigurationForm() (Line: 59)
editor_form_filter_admin_format_validate()
call_user_func_array() (Line: 82)
Drupal\Core\Form\FormValidator->executeValidateHandlers() (Line: 275)
Drupal\Core\Form\FormValidator->doValidateForm() (Line: 118)
Drupal\Core\Form\FormValidator->validateForm() (Line: 585)
Drupal\Core\Form\FormBuilder->processForm() (Line: 321)
Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)
Drupal\Core\Controller\FormController->getContentResult()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 593)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 183)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 116)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 90)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 53)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 715)
Drupal\Core\DrupalKernel->handle() (Line: 19)
Comment #10
kenrbnsn commentedSteps to reproduce:
* Install a fresh copy of Drupal v11.1.4
* drush si -y
* Login in as admin
* In admin/config/content/formats click on configure of Full Html
* Drag "Styles" to active toolbar
* Add a test style to the box
* Click "Save"
Error appears.
Comment #11
znerol commentedThis might be a race condition. I was able to reproduce the trace by dragging the style button to the toolbar, then immediately clicking on save configuration. The moment when I hit the button, the following error appeared in the browser console:
Object { message: "\nAn AJAX HTTP request terminated abnormally.\nDebugging information follows.\nPath: /admin/config/content/formats/manage/basic_html?destination=/admin/config/content/formats%3Fcheck_logged_in%3D1&ajax_form=1\nStatusText: error\nReadyState: 0", name: "AjaxError", stack: "@http://localhost:8888/core/misc/ajax.js?v=11.1.4:196:32\n@http://localhost:8888/core/misc/ajax.js?v=11.1.4:1926:3\n" }My hunch is that the XHR request following the drag&drop action has been terminated before it had a chance to update the form on the server.
Comment #12
znerol commentedComment #13
znerol commentedComment #14
znerol commentedThe assertion triggers inside form validation code. If the site crashes while validating user input, then the validation process is maybe not implemented properly.
How about converting this assertion into an if-condition?
Comment #15
cadence96I’ve identified that the AssertionError no longer occurs and saving works as expected when following these steps:
I'm using DDEV, Drupal 10.3.7.
However, another issue remains: the Styles dropdown in CKEditor does not display any available classes (screenshot attached for reference).
Comment #16
m.zerres commentedSolution: You have to click the tab key to get the values saved. Then you can save the configuration.
Comment #17
ishani patel commentedComment #18
ishani patel commentedHello
lluisandreu,
I've faced the same issue when I enable the "styles" in the active toolbar.
Then, as mentioned in #16, I clicked on the styles tab, added one style, and saved the configuration.
It's working fine for me.
Please check the screencast below for the same.
Working Link: Ckeditor5 Style
Please check and review
Thank you!
Comment #19
smustgrave commentedSo question is if still an issue in D11
Comment #20
znerol commentedIt is an issue and it is reproducible reliably with the steps in the IS. But probably not easy for test automation (because its a race condition).
Comment #21
ishani patel commentedHello smustgrave,
As I mentioned in my above comment, it's working for me.
Can you please check my video, as I added a working link.
Solution Link: https://www.loom.com/share/18cbf606ea6c4fc38db627ee944e343c?sid=1e497ea1...
Please review and let me know your thoughts.
Thank you!
Comment #22
camerongreen commentedThis is still and issue for me in D11. Following the instructions in #15 was the only way to make it work.
Comment #23
ju.vanderw commented#16 solution worked for me. I was able to successfully save a style, Drupal core 10.5.3
Comment #25
peter törnstrand commentedWow ... it really did work.
Comment #26
mandclu commentedI ran into this issue on a fresh install of Drupal 11.3. I tried the tab solution in #16 and it didn't work for me. Resubmitting the form values consistently reproduced the error.
Strangely, I reverted to a db backup from just before I had edited the text format, and when I tried to reproduce the error on the same site following the same steps it worked as expected. It does indeed seem to be some kind of race condition.
Comment #27
mandclu commentedSomething interesting to note: I also came across #3256616: AssertionError: assert($value === TRUE || Inspector::assertAllStrings($value)) in assert() (line 242 of core/modules/ckeditor5/src/HTMLRestrictionsUtilities.php) which was closed as a duplicate of #3262484: AJAX desync when quickly changing multiple form values in plugin settings vertical tab, with a temporary solution at https://www.drupal.org/project/drupal/issues/3326261#comment-15181215 that is similar to the tab solution suggested in #16 here.
Maybe this should also be closed as a duplicate? It sure would be nice to see some momentum in #3262484: AJAX desync when quickly changing multiple form values in plugin settings vertical tab though.
Comment #28
bjcooper commentedI found another way to break this (I'm on 11.3.8) that I think doesn't require any AJAX race conditions, for anyone who might possibly run into it.
ckeditor5_sourceEditing) plugin activeallowed_tags) field (in my case, I was allowing editors to add classes to elements, so I had<h2 class> <h3 class> <h4 class> <h5 class> <h6 class> <div class> <span class> <p class>)ckeditor5_style) plugin...elements: ['<$any-html5-element class>']validation wildcard overlaps with the Source editing allowed tags, causes a validation error, and prevents the Style plugin from properly loading.You can even cause this by enabling the style plugin directly via valid config. If you then visit the filter format configuration page, you'll see the
AssertionErrorin non-AJAX form.The workaround is to clear the conflicting
<tag class>entries from the Source editing allowed tags, then enable the Style plugin.