Duplicate anchor names in YAML 1.2 create inconsistent alias resolution across parsers
0 reputation · 22 May 2026, 19:10 UTC
Anchor and alias resolution is a documented YAML 1.2 feature for reusing structures with & and * syntax. The specification does not forbid duplicate anchor names, leaving the handling of later definitions and alias binding unspecified.
Because the behavior is unspecified, different parser implementations can resolve the same document differently. That ambiguity creates a compatibility boundary for configuration files shared across tools and CI/CD pipelines, and raises questions about data integrity and security when anchor names are reused unintentionally or maliciously.
The goal is to clarify the intended semantics for duplicate anchors in a YAML 1.2 context under version assumptions for SnakeYAML, ruamel.yaml and libyaml.
Questions:
- Should duplicate anchor names be treated as an error by default in YAML 1.2 parsers, or remain allowed?
- If duplicates are allowed, what deterministic resolution rule for alias binding should be documented?
- How should user-facing workflows signal ambiguity around duplicate anchors without breaking existing documents?