PARSER ERROR CODES

cvc-id.1 / cvc-id.2: broken ID bindings

XSDHub · Tested 5 November 2026 · How we test guides

An xs:ID value identifies one item within a document; an xs:IDREF refers to such an identifier. Xerces uses cvc-id.1 for a reference with no matching ID and cvc-id.2 when the same ID occurs more than once. These checks depend on the document’s identity relationships.

What the message literally means

The reference specimen declares item A1 but links to A2, which does not exist. Pointing the link to A1 repairs the binding. The duplicate specimen assigns A1 to two items; assigning A2 to the second item restores uniqueness. Changing an ID in production also requires updating every reference intended to point to that item.

Three common causes to check first

  1. The referenced item was filtered out, moved to another document or renamed without updating its links. IDREF resolution concerns the current document, not a remote business database.
  2. Two source records reuse one generated ID. Merging XML fragments can introduce collisions even when each original fragment was internally unique.
  3. The schema does not type the relevant fields as xs:ID and xs:IDREF. An ordinary string attribute named id does not automatically acquire schema identity semantics.

Repair and retest

Collect all typed IDs and references from the complete document, then check uniqueness and missing targets separately. Follow the source record behind each collision before regenerating identifiers. Validate after all referenced records are present; forward references can be legal, so a reference appearing before its target is not itself proof of failure.

When this is a namespace problem

The ID values in these specimens are identifiers, not namespace-qualified element names. Changing xmlns does not create a missing A2 or make duplicate A1 values unique. Namespaces matter when they prevent an attribute or element from receiving the intended ID datatype; inspect the declaration and qualification before assuming an identity check actually ran.

Reading equivalent reports

The measured libxml2/WASM engine returns success for the missing-target specimen, while Xerces, .NET and XSDHub’s server engine reject it. The IDREF buttons therefore select the existing second engine and reveal its unchecked upload-permission control. Loading the pair sends nothing; grant permission and choose Validate XML to run it. Local duplicate-ID checking does fail as shown.

Complete tested XML and XSD pairs

Open either variant in the workbench, then choose Validate XML. Loading an example does not run validation or send documents; server checks require the existing permission checkbox.

These transcripts were captured on 5 November 2026 from the exact files shown below. Download all measured results and SHA-256 hashes.

Unresolved IDREF / cvc-id.1

Broken XML

<catalog>
  <item id="A1"/>
  <link ref="A2"/>
</catalog>
Broken complete XSD
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="catalog">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="item" maxOccurs="unbounded">
          <xs:complexType>
            <xs:attribute name="id" type="xs:ID" use="required"/>
          </xs:complexType>
        </xs:element>
        <xs:element name="link" minOccurs="0">
          <xs:complexType>
            <xs:attribute name="ref" type="xs:IDREF" use="required"/>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

Download XML · Download XSD

Open broken pair →

Corrected XML

<catalog>
  <item id="A1"/>
  <link ref="A1"/>
</catalog>
Corrected complete XSD
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="catalog">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="item" maxOccurs="unbounded">
          <xs:complexType>
            <xs:attribute name="id" type="xs:ID" use="required"/>
          </xs:complexType>
        </xs:element>
        <xs:element name="link" minOccurs="0">
          <xs:complexType>
            <xs:attribute name="ref" type="xs:IDREF" use="required"/>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

Download XML · Download XSD

Open corrected pair →

Same specimen across engines

EngineBroken: actual reportCorrected
Apache Xerces-J 2.12.2
Validation
cvc-id.1: There is no ID/IDREF binding for IDREF 'A2'.
PASS
.NET 8.0.33 · System.Xml.Schema
Validation
Reference to undeclared ID is 'A2'.
PASS (no warnings)
XSDHub libxml2/WASM 0.7.2
Validation
PASS: no validation diagnostic.
PASS
XSDHub xmlschema 4.3.1 · XSD 1.0
Validation
IDREF 'A2' not found in XML document
PASS
SaxonEE comparison: cvc-id.1 describes the corresponding XSD constraint. No Saxon-EE run or wording is claimed; an EE licence is unavailable in this test environment. Saxon-HE does not provide XSD validation.Not run

Duplicate ID / cvc-id.2

Broken XML

<catalog>
  <item id="A1"/>
  <item id="A1"/>
</catalog>
Broken complete XSD
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="catalog">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="item" maxOccurs="unbounded">
          <xs:complexType>
            <xs:attribute name="id" type="xs:ID" use="required"/>
          </xs:complexType>
        </xs:element>
        <xs:element name="link" minOccurs="0">
          <xs:complexType>
            <xs:attribute name="ref" type="xs:IDREF" use="required"/>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

Download XML · Download XSD

Open broken pair →

Corrected XML

<catalog>
  <item id="A1"/>
  <item id="A2"/>
</catalog>
Corrected complete XSD
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="catalog">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="item" maxOccurs="unbounded">
          <xs:complexType>
            <xs:attribute name="id" type="xs:ID" use="required"/>
          </xs:complexType>
        </xs:element>
        <xs:element name="link" minOccurs="0">
          <xs:complexType>
            <xs:attribute name="ref" type="xs:IDREF" use="required"/>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

Download XML · Download XSD

Open corrected pair →

Same specimen across engines

EngineBroken: actual reportCorrected
Apache Xerces-J 2.12.2
Validation
cvc-id.2: There are multiple occurrences of ID value 'A1'.
cvc-attribute.3: The value 'A1' of attribute 'id' on element 'item' is not valid with respect to its type, 'ID'.
PASS
.NET 8.0.33 · System.Xml.Schema
Validation
'A1' is already used as an ID.
PASS (no warnings)
XSDHub libxml2/WASM 0.7.2
Validation
Element 'item', attribute 'id': 'A1' is not a valid value of the atomic type 'xs:ID'.
PASS
XSDHub xmlschema 4.3.1 · XSD 1.0
Validation
attribute id='A1': duplicated xs:ID value 'A1'
PASS
SaxonEE comparison: cvc-id.2 describes the corresponding XSD constraint. No Saxon-EE run or wording is claimed; an EE licence is unavailable in this test environment. Saxon-HE does not provide XSD validation.Not run

Saxon comparison and test scope

Saxonica documents XSD processing as an Enterprise Edition feature. The Saxon rows map the named constraint, rather than presenting an invented message. The four measured rows are Xerces, .NET, the shipped workbench engine and XSDHub’s second engine.

The corrected results apply to these self-contained XSD 1.0 specimens. They do not establish business-rule acceptance for a different document or schema version.

Continue the diagnosis

All parser error codes · XML and XSD validator

Primary references