Skip to content

content layer silently overrides records with duplicate ids #13948

@zemccartney

Description

@zemccartney

Astro Info

Astro                    v5.9.3
Node                     v22.14.0
System                   macOS (arm64)
Package Manager          npm
Output                   static

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

If you use the same id across multiple entries in a content collection, that id will resolve to the latest entry in source order

What's the expected result?

An error / otherwise louder indication of a mistake or at least documentation of this behavior of the content layer. I'm totally aware this is more my opinion than a bug proper, but I think it's fair to treat duplicate ids as a mistake, announcing as such, instead of relying on the user to understand how the underlying key-value store will handle them (happily use the id to set a record, overriding each time said is used, since the kv has no concept of uniqueness constraints).

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-r7fddqct

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs triageIssue needs to be triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions