generated/1151/a collection key written twice

sha256 5bff2e420315a7a3acd8c4d9dbe7485f716ddc8825e5f2b84a5ac3a0ae5fee54

Document

---
!<!foo>
# c1
base: &m1 # c2
  # c3
  b0: -2 # c4
  # c5
  b1: -6 # c6
  # c7
  b2: -7 # c8
# c9
item: # c10
  # c11
  <<: !<!foo> # c12
    # c13
    - *m1 # c14
    # c15
    - # c16
      # c17
      c0: 4 # c18
      # c19
      !<tag:yaml.org,2002:str> c1: !<tag:yaml.org,2002:int> -1 # c20
  # c21
  d0: !<tag:yaml.org,2002:int> -8 # c22
  # c23
  d1: 0 # c24
  # c25
  b0: 99 # c26
# c27
?
  # c28
  - base # c29
: dup # c30
# c31
?
  # c32
  - base # c33
: dup2 # c34

Corpus

grammarvalid, vouched for up to construct
key/duplicatereject from parse on, 3.2.1.1: it is an error for two equal keys to appear in the same mapping node
featuresnode/alias node/anchor node/tag-verbatim presentation/comment-above presentation/comment-inline presentation/document-marker presentation/explicit-key presentation/key-below-the-indicator presentation/plain value/int value/mapping value/merge-key value/non-string-key value/sequence value/string
meaning (none stated)

Answer groups

verdict split

go-yaml yaml.v3

refuse by the loader

libfyaml

accept, then the loader refuses past parse

perlref yamlstar

accept

value

yamlstar

{"[\"base\"]":"dup2","base":{"b0":-2,"b1":-6,"b2":-7},"item":{"b0":99,"b1":-6,"b2":-7,"c0":4,"c1":-1,"d0":-8,"d1":0}}

roundtrip

No source answered.

Each parser

parserverdictvalueround tripreasonmessage
perlref accepted accept n/i n/i key/duplicate: the grammar has no production against a key written twice, and the reference parser implements the grammar alone, so it does not check this settled rule
libfyaml accepted refuse by the loader not scored n/i key/duplicate: fy-tool writes events without checking for a key written twice, and accepts most documents that write one TypeError: unhashable type: 'sequence'
yamlstar accepted accept not scored n/i key/duplicate: the loader does not check this settled rule: it keeps the last value of a key written twice, so "a: 1\na: 2" loads as {"a": 2}
yaml.v3 rejected, settled refuse by the loader not scored refused key/duplicate: 3.2.1.1: it is an error for two equal keys to appear in the same mapping node yaml.v3: yaml: unmarshal errors:
go-yaml rejected, settled refuse by the loader not scored refused key/duplicate: 3.2.1.1: it is an error for two equal keys to appear in the same mapping node [32:3] a sequence cannot be a JSON key

Corpus compact, 28279 cases, yamlcorpus/48. Run 2026-11-26 22:12 UTC, 23m30s.