oven-sh/bun · error

more than 256 distinct packed values

Error message

more than 256 distinct packed values

What it means

Error "more than 256 distinct packed values" thrown in oven-sh/bun.

Source

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

// ---------------------------------------------------------------------------
// Rebuild the 3-stage table over the packed values
// ---------------------------------------------------------------------------

const highCount = stage1.length; // 8192 blocks of 256 codepoints
const blockKeyToOffset = new Map();
const newStage1 = new Array(highCount);
const newStage2 = [];
const valueToIndex = new Map();
const newStage3 = [];

for (let high = 0; high < highCount; high++) {
  const block = new Array(256);
  for (let low = 0; low < 256; low++) {
    const value = packed(high * 256 + low);
    let index = valueToIndex.get(value);
    if (index === undefined) {
      index = newStage3.length;
      if (index > 255) throw new Error("more than 256 distinct packed values");
      valueToIndex.set(value, index);
      newStage3.push(value);
    }
    block[low] = index;
  }
  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

View on GitHub (pinned to 8c5296ac45)

When it happens

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