Base path validation throws false conflict error when saving External Entity Type

Created on 21 August 2025, about 1 month ago

Problem/Motivation

When editing an External Entity Type, the Base path field validation may incorrectly block saving with the error:

This base path is already in use by another module (module "unknown" uses route "layout_builder.overrides.couch_doc.discard_changes: /external-apartment/{couch_doc}/layout/discard-changes").

Even though:

  • Layout Builder is not enabled or used for this entity type.
  • The route actually belongs to the same derived external entity type being edited.

This results in a situation where:

  • On first save, the Base path works.
  • On subsequent edits, validation fails with a false conflict, forcing the user to alternate between names (e.g., external-apartment → external-apartmentx → external-apartment).

This makes the Base path feature unreliable and confusing.

Steps to reproduce

  1. Create a new External Entity Type with base path external-apartment.
  2. Save it successfully.
  3. Reopen the type form (/admin/structure/external-entity-types/{your_type}) and attempt to save again without changing the base path.
  4. Observe the error message about the base path already being in use, even though it belongs to the same entity type.

Root cause

The current base path validator in ExternalEntityTypeForm::validateForm():

  • Iterates over all routes in the system to check for collisions.
  • It does not correctly exclude routes derived from the same external entity type (e.g., entity routes, override routes, placeholders like /{couch_doc}).
  • These show up with module = unknown, so the validator assumes they are conflicts from another module.

As a result, the form misreports self-owned routes as collisions.

Proposed resolution

Update the base path validation logic to:

  • Skip any routes with defaults that target the same external entity type (_entity_type or entity_type_id matches).
  • Skip known per-entity route prefixes (entity.<type_id>., layout_builder.overrides.<type_id>., etc.).
  • Skip routes with placeholders for the same entity type in their path (e.g., /{couch_doc}).
  • Only flag real conflicts when the path belongs to another entity type or unrelated module.

This ensures that entity types can be edited repeatedly with the same base path without spurious errors, while still preventing true conflicts with other routes (e.g., /user, /node, /admin).

🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

🇩🇪Germany marcusx

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024