microsoft/edit · error

Unrecognized InCB={} for U+{:04X} to U+{:04X}

Error message

Unrecognized InCB={} for U+{:04X} to U+{:04X}

What it means

After validating the GCB/InCB combination, the generator maps the Indic_Conjunct_Break string to InCBLinker/InCBConsonant; any other non-None/non-Extend string reaches the catch-all bail. Like the GCB check, this protects the exhaustiveness of generated tables against unknown Unicode data values.

Source

Thrown at crates/unicode-gen/src/main.rs:847

            }

            if !matches!(char_attributes.indic_conjunct_break, "None" | "Extend") {
                // If it's not None/Extend, it's Linker/Consonant, and currently
                // all of them are GCB=EX/XX. Since we treat them almost like extenders,
                // we need to revisit our assumptions if this ever changes.
                if !matches!(cb, ClusterBreak::Other | ClusterBreak::Extend) {
                    bail!(
                        "Unexpected GCB={} with InCB={} for U+{:04X} to U+{:04X}",
                        char_attributes.grapheme_cluster_break,
                        char_attributes.indic_conjunct_break,
                        range.start(),
                        range.end()
                    );
                }
                cb = match char_attributes.indic_conjunct_break {
                    "Linker" => ClusterBreak::InCBLinker,
                    "Consonant" => ClusterBreak::InCBConsonant,
                    _ => bail!(
                        "Unrecognized InCB={} for U+{:04X} to U+{:04X}",
                        char_attributes.indic_conjunct_break,
                        range.start(),
                        range.end()
                    ),
                };
            }

            let mut cw = match char_attributes.east_asian {
                "N" | "Na" | "H" => CharacterWidth::Narrow, // Half-width, Narrow, Neutral
                "F" | "W" => CharacterWidth::Wide,          // Wide, Full-width
                "A" => ambiguous_value,                     // Ambiguous
                _ => bail!(
                    "Unrecognized ea={} for U+{:04X} to U+{:04X}",
                    char_attributes.east_asian,
                    range.start(),
                    range.end()
                ),

View on GitHub (pinned to 826b4c097b)

Solutions

  1. Use the official UCD XML matching the generator's supported Unicode version.
  2. Add the new InCB value to ClusterBreak and a mapping arm in extract_values_from_ucd.
  3. Verify the field is populated from the Indic_Conjunct_Break attribute (check the parsing code) if values look shifted.

Example fix

// before
_ => bail!("Unrecognized InCB={} ..."),
// after
"NewKind" => ClusterBreak::InCBNewKind,
_ => bail!("Unrecognized InCB={} ..."),
Defensive patterns

Strategy: try-catch

Validate before calling

// validate InCB attribute domain before generating
const INCB_VALUES: &[&str] = &["None", "Extend", "Linker", "Consonant"];
for node in doc.descendants().filter(|n| n.has_attribute("InCB")) {
    let v = node.attribute("InCB").unwrap();
    assert!(INCB_VALUES.contains(&v), "unknown InCB value {v}");
}

Try / catch

match generate(&ucd_path) {
    Err(e) if e.to_string().starts_with("Unrecognized InCB=") => {
        eprintln!("UCD contains an InCB value this generator does not model: {e}");
        std::process::exit(1);
    }
    r => r?,
}

Prevention

When it happens

Trigger: A UCD XML containing an Indic_Conjunct_Break value outside {None, Extend, Linker, Consonant} — a newer Unicode property value, a misspelled/hand-edited attribute, or a different UCD property accidentally parsed into indic_conjunct_break.

Common situations: Future Unicode versions adding InCB values; corrupted or third-party-modified UCD files; wiring the wrong XML attribute into char_attributes.indic_conjunct_break during a refactor.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of microsoft/edit@826b4c097b (2026-09-06). Data as JSON: /api/errors/24a0444bb1d44772. Report an issue: GitHub.