Overview
@jessebaker from #3520071: Show human readable error messages when creating component fails suggested making the error messages returned from the server more user friendly.
Code component creation
For example, when you try to create a code component with a name that already exists,
'js_component' entity with ID 'my_test' already exists. gets returned. But this could maybe be updated to something like A component with that name already exists, use a unique name.
For code component creation I think the above is the only error that will be shown to the user (to my knowledge) because #3520071: Show human readable error messages when creating component fails adds front-end validation for invalid names (special characters, starts with a number).
Section creation
Regarding sections, it looks like you are able to create sections with the same name. Don't know if this is expected behavior or a bug, but would like someone on the backend to confirm that. If it is a bug, then the error message for that should be user-friendly too.
You also get a 500 error where I would expect a 422 error when I try to create a section named !@#$. And I was able to create sections that contains special characters like ###Shoe icon section and %f where I would also have expected a 422 based on the code component behavior. (See screenshot)
Should sections also use the same regex that code components use for checking if something is a valid name for consistency? Or are sections under different rules than JS components?

Proposed resolution
- Update server responses to something more user friendly, less developer-oriented.
- Consider making errors consistent between JS components and Sections
User interface changes
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | Screenshot 2025-05-12 at 3.36.43 PM.png | 190.78 KB | hooroomoo |
Comments
Comment #2
hooroomooComment #3
penyaskitoTrue, their ids are autogenerated from the label and in case of collision we append a random string.
This was definitely intentional when implemented, but looks inconsistent with other entities. We might want to revisit this. For archeology, this happened in #3486203: Integrate saving sections with the backend: (de)normalize Pattern config entities using the client-side data model
Comment #4
hooroomooComment #5
hooroomooComment #6
hooroomooComment #7
hooroomooComment #8
hooroomooComment #9
hooroomooComment #10
hooroomooComment #11
hooroomoo