{"record":{"id":"6caca931154bb36b","repo":"oven-sh/bun","slug":"ucd-needs-a-directory-argument","errorCode":null,"errorMessage":"--ucd needs a directory argument","messagePattern":"--ucd needs a directory argument","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/generate-stringwidth-tables.mjs","lineNumber":38,"sourceCode":"//        emoji-data.txt for UNICODE_VERSION.\n\nimport { readFileSync, writeFileSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nconst UNICODE_VERSION = \"17.0.0\";\nconst UCD_BASE = `https://www.unicode.org/Public/${UNICODE_VERSION}/ucd`;\n\nconst headerPath = join(dirname(fileURLToPath(import.meta.url)), \"../src/jsc/bindings/stringWidthTables.h\");\nconst header = readFileSync(headerPath, \"utf8\");\n\n// ---------------------------------------------------------------------------\n// Load Unicode data\n// ---------------------------------------------------------------------------\n\nconst args = process.argv.slice(2);\nconst ucdDirIndex = args.indexOf(\"--ucd\");\nif (ucdDirIndex !== -1 && !args[ucdDirIndex + 1]) throw new Error(\"--ucd needs a directory argument\");\nconst ucdDir = ucdDirIndex !== -1 ? args[ucdDirIndex + 1] : null;\n\nasync function loadUCD(remotePath) {\n  const name = remotePath.split(\"/\").pop();\n  if (ucdDir) return readFileSync(join(ucdDir, name), \"utf8\");\n  const url = `${UCD_BASE}/${remotePath}`;\n  const response = await fetch(url);\n  if (!response.ok) throw new Error(`GET ${url} failed: ${response.status} ${response.statusText}`);\n  return await response.text();\n}\n\nconst eastAsianWidthText = await loadUCD(\"EastAsianWidth.txt\");\nconst generalCategoryText = await loadUCD(\"extracted/DerivedGeneralCategory.txt\");\nconst emojiDataText = await loadUCD(\"emoji/emoji-data.txt\");\n\n// Parse `LO(..HI) ; VALUE # comment` lines whose VALUE is accepted by `wanted`.\nfunction parseUCDRanges(text, wanted) {\n  const ranges = [];","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/oven-sh/bun/blob/8c5296ac459e8252d3cd702f3fbcbb0c249d95d5/scripts/generate-stringwidth-tables.mjs#L20-L56","documentation":"Error \"--ucd needs a directory argument\" thrown in oven-sh/bun.","triggerScenarios":"Thrown at scripts/generate-stringwidth-tables.mjs:38 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8c5296ac459e8252d3cd702f3fbcbb0c249d95d5","analyzedAt":"2026-08-16T08:01:58.794Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}