Description
When two or more extend statements apply aspects to the same entity and both aspects define an element with the same name, a duplicate element conflict arises. In CDS compiler v6.9, this situation was promoted from a silent acceptance to a configurable warning (name-duplicate-element). In CDS compiler v7 (CDS 10), the warning becomes a non-configurable hard error. Any data model where multiple aspect extensions introduce elements with the same name to the same entity will fail to compile. The recommended fix is to rename one of the conflicting elements or to consolidate the duplicates into a single aspect.
How to Check
- [ ] Run
cds compilewith@sap/cds-compilerv6.9 or later before upgrading to v7 — thename-duplicate-elementwarning will identify all affected entities. - [ ] After upgrading to CDS 10, run
cds compile— affected files will produce hard errors. - [ ] Search for
\bextend\bin.cdsfiles to find all extend statements and manually review entities that are extended by multiple aspects.
Migration Steps
Identify conflicting element names using the v6.9 compiler warning output, then locate the duplicate element definitions in the contributing aspects:
cds// Two aspects both define an element named 'status' aspect Auditable { status : String; } aspect Trackable { status : Integer; } entity Orders : Auditable, Trackable { key ID : UUID; } // Hard error in v7: duplicate element 'status'Rename the conflicting element in one of the aspects to remove the ambiguity:
diffaspect Auditable { status : String; } - aspect Trackable { status : Integer; } + aspect Trackable { trackStatus : Integer; } entity Orders : Auditable, Trackable { key ID : UUID; }Alternatively, consolidate both aspects if they logically belong together:
diff- aspect Auditable { status : String; } - aspect Trackable { status : Integer; } + aspect Auditable { status : String; trackStatus : Integer; }Update all
annotate, service projections, and application code that reference the renamed element.
Notes
The name-duplicate-element warning was available from CDS compiler v6.9. Running the pre-upgrade check with this compiler version is the most reliable way to surface all affected entities before the hard error in v7 blocks the build. If the project cannot run v6.9 before upgrading, rely on the compiler error output from v7 to identify conflicts one by one.