oven-sh/bun · error

--ucd needs a directory argument

Error message

--ucd needs a directory argument

What it means

Error "--ucd needs a directory argument" thrown in oven-sh/bun.

Source

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

//        emoji-data.txt for UNICODE_VERSION.

import { readFileSync, writeFileSync } from "node:fs";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";

const UNICODE_VERSION = "17.0.0";
const UCD_BASE = `https://www.unicode.org/Public/${UNICODE_VERSION}/ucd`;

const headerPath = join(dirname(fileURLToPath(import.meta.url)), "../src/jsc/bindings/stringWidthTables.h");
const header = readFileSync(headerPath, "utf8");

// ---------------------------------------------------------------------------
// Load Unicode data
// ---------------------------------------------------------------------------

const args = process.argv.slice(2);
const ucdDirIndex = args.indexOf("--ucd");
if (ucdDirIndex !== -1 && !args[ucdDirIndex + 1]) throw new Error("--ucd needs a directory argument");
const ucdDir = ucdDirIndex !== -1 ? args[ucdDirIndex + 1] : null;

async function loadUCD(remotePath) {
  const name = remotePath.split("/").pop();
  if (ucdDir) return readFileSync(join(ucdDir, name), "utf8");
  const url = `${UCD_BASE}/${remotePath}`;
  const response = await fetch(url);
  if (!response.ok) throw new Error(`GET ${url} failed: ${response.status} ${response.statusText}`);
  return await response.text();
}

const eastAsianWidthText = await loadUCD("EastAsianWidth.txt");
const generalCategoryText = await loadUCD("extracted/DerivedGeneralCategory.txt");
const emojiDataText = await loadUCD("emoji/emoji-data.txt");

// Parse `LO(..HI) ; VALUE # comment` lines whose VALUE is accepted by `wanted`.
function parseUCDRanges(text, wanted) {
  const ranges = [];

View on GitHub (pinned to 8c5296ac45)

When it happens

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