Active
Project:
Drupal Canvas
Version:
1.x-dev
Component:
Page builder
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
31 Jan 2025 at 10:05 UTC
Updated:
5 Nov 2025 at 12:19 UTC
Jump to comment: Most recent, Most recent file

Comments
Comment #2
balintbrewsMade some edits to better reflect that errors are already handled, but the error details are not exposed.
Besides the 422 error, what other errors can we expect?
Currently sending a
machineNamethat's already taken results in a 500 error, which Wim already explained in a Slack conversation that:With that said, I don't think we should be concerned about that before we tackle #3503272: JavaScriptComponent config entities should have mutable machineNames, which would mean the client doesn't need to send what is used as the
identity key for the config entity.Comment #3
wim leersWe'll need to change that to return a 409 (conflict).
No other HTTP status codes; you should only see 409 and 422.
Note: I agree the value is currently limited. But as soon as #3500017: Defining props for code components lands, there'll be even more possibilities for validation errors: props must be named in a particular way, for example (just like
machineNamein the example above). And the name of a prop must not be used by a slot, and vice versa.So: the more complete #3499919: [Meta] Plan for in-browser code components becomes, the more valuable this becomes.
For more context:
\Drupal\experience_builder\Controller\ApiConfigControllers::post()should generate a 409 for a duplicate entity ID!\Drupal\Tests\experience_builder\Kernel\Config\JavaScriptComponentValidationTest::providerTestEntityShapes()that start with the string'Invalid:for a sense of what validation errors could occur.\Drupal\Tests\experience_builder\Functional\XbConfigEntityHttpApiTest::testJavaScriptComponent(). I know for sure that the renaming/remapping in\Drupal\experience_builder\Entity\JavaScriptComponent::normalizeForClientSide()is not being respected when generating validation errors, so a validation error for a key the client sent may return a validation error for a different key: in the server-side representation.\Drupal\experience_builder\Controller\ApiConfigControllersshould be usingConstraintPropertyPathTranslatorTraitbut doesn't yet.… but none of that is actually a blocker for this issue — this issue can pretend none of those problems exist, and in a future server-side issues we can fix all that — when somebody runs into it :)
Did you see
?
That'd literally prevent the 422 in the screenshot from ever occurring!
Comment #4
wim leersCreated issue for #3.1: #3504366: ApiConfigControllers::post() should detect a conflicting ID and throw a 409 exception.
Comment #6
wim leersIt's possible to run into the same problem for the "section" creation dialog: #3504434: ConstraintViolationException: Validation errors exist when creating section.
Comment #7
wim leersFixed: #3504366: ApiConfigControllers::post() should detect a conflicting ID and throw a 409 exception 😊
So #3.1 is fixed, the rest isn't yet.
(That also now guarantees that
422responses follow that helpful format — thanks to tightening/openapi.yml.)Comment #8
kristen polI'm seeing this with latest XB+SDDS.
Added 4 columns with cards in each slot and tried to create a section from that and it gives:
but the alt text exists on each image.
Comment #9
wim leers#8: that particular error seems a duplicate of #3509608: Unable to save an optional image with its default value (because it does not correspond to a Media entity): allow saving DefaultRelativeUrlPropSource. See this issue's summary: this is about generally actually displaying validation errors.
Will re-post your comment there and credit you 👍
Comment #10
wim leersFYI: #3514035: Creating multiple components with same label causes error: entity with ID already exists was created for a subset of what this issue is about — specifically the 409 (conflict) case that @balintbrews surfaced in #2.
Comment #11
wim leersAll of the following call for this to be implemented:
That would increase the quality/detail of many bug reports.
Comment #12
hooroomooComment #13
hooroomooAdding related issue here, whoever picks this up should check that issue to see if anything can be re-used for the other dialogs.
Comment #14
hooroomoo#3520071: Show human readable error messages when creating component fails displays errors for code component creation so renaming the title here
Comment #15
hooroomooComment #17
balintbrews