oven-sh/bun · error

UCD parse sanity check failed

Error message

UCD parse sanity check failed

What it means

Error "UCD parse sanity check failed" thrown in oven-sh/bun.

Source

Thrown at scripts/generate-stringwidth-tables.mjs:120

  const high = cp >> 8;
  const low = cp & 0xff;
  return stage3[stage2[stage1[high] + low]] & 0x1f;
};

const inRanges = (cp, ranges) => {
  let lo = 0;
  let hi = ranges.length;
  while (lo < hi) {
    const mid = (lo + hi) >> 1;
    if (ranges[mid][0] <= cp) lo = mid + 1;
    else hi = mid;
  }
  return lo > 0 && cp <= ranges[lo - 1][1];
};

// Guard against a UCD format change silently emptying a table.
if (!inRanges(0x4e00, wideRanges) || !inRanges(0x300, nonspacingMarkRanges) || !inRanges(0x1f600, emojiRanges))
  throw new Error("UCD parse sanity check failed");

// ---------------------------------------------------------------------------
// Width classification
// ---------------------------------------------------------------------------

// Zero-width: controls, every nonspacing/enclosing mark (Mn/Me), conjoining
// Hangul jungseong/jongseong, and the invisible format characters glibc
// wcwidth() and string-width treat as zero-width. Deliberate deviations:
// prepended concatenation marks (U+0600..) are zero-width, and the Indic
// block heuristic below also zero-widths spacing vowel signs (Mc) so a
// consonant+vowel-sign syllable stays one column.
function isZeroWidth(cp) {
  if (cp <= 0x1f) return true;
  if (cp >= 0x7f && cp <= 0x9f) return true;
  if (cp === 0xad) return true;
  if (inRanges(cp, nonspacingMarkRanges)) return true;
  // Hangul jungseong (V) and jongseong (T): an L+V(+T) conjoining cluster is
  // 2 columns wide, all carried by the leading consonant.

View on GitHub (pinned to 8c5296ac45)

When it happens

Trigger: Thrown at scripts/generate-stringwidth-tables.mjs:120 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/e8725c02e3deb9ce. Report an issue: GitHub.