oven-sh/bun · error
class mismatch at U+${cp.toString(16)}
Error message
class mismatch at U+${cp.toString(16)} What it means
Error "class mismatch at U+${cp.toString(16)}" thrown in oven-sh/bun.
Source
Thrown at scripts/generate-stringwidth-tables.mjs:236
}
const key = block.join(",");
let offset = blockKeyToOffset.get(key);
if (offset === undefined) {
offset = newStage2.length;
blockKeyToOffset.set(key, offset);
newStage2.push(...block);
}
newStage1[high] = offset;
}
if (newStage2.length - 256 > 0xffff) throw new Error("stage1 offsets no longer fit in uint16_t");
// Verify the rebuilt table roundtrips for every codepoint and preserves the
// original grapheme classes exactly.
for (let cp = 0; cp <= 0x10ffff; cp++) {
const got = newStage3[newStage2[newStage1[cp >> 8] + (cp & 0xff)]];
if (got !== packed(cp)) throw new Error(`roundtrip mismatch at U+${cp.toString(16)}`);
if ((got & 0x1f) !== classOf(cp)) throw new Error(`class mismatch at U+${cp.toString(16)}`);
}
// ---------------------------------------------------------------------------
// Emit
// ---------------------------------------------------------------------------
function formatArray(values, perLine) {
const lines = [];
for (let i = 0; i < values.length; i += perLine) {
lines.push(" " + values.slice(i, i + perLine).join(", ") + ",");
}
return lines.join("\n");
}
const output = `// clang-format off
// Generated by scripts/generate-stringwidth-tables.mjs from the Unicode
// ${UNICODE_VERSION} Character Database. Do not edit manually; regenerate with
// bun scripts/generate-stringwidth-tables.mjsView on GitHub (pinned to 8c5296ac45)
When it happens
Trigger: Thrown at scripts/generate-stringwidth-tables.mjs:236 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of oven-sh/bun@8c5296ac45 (2026-08-16).
Data as JSON: /api/errors/37f1ab7e5648680d.
Report an issue: GitHub.