{"record":{"id":"bb296ca43cc06258","repo":"chenglou/pretext","slug":"missing-id-available-corpora-object-keys-fon","errorCode":null,"errorMessage":"Missing --id. Available corpora: ${Object.keys(FONT_MATRIX).join(', ')}","messagePattern":"Missing --id\\. Available corpora: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/corpus-font-matrix.ts","lineNumber":362,"sourceCode":"  return parsed\n}\n\nfunction parseBrowser(value: string | null): BrowserKind {\n  const browser = (value ?? process.env['CORPUS_CHECK_BROWSER'] ?? 'chrome').toLowerCase()\n  if (browser !== 'chrome' && browser !== 'safari') {\n    throw new Error(`Unsupported browser ${browser}; expected chrome or safari`)\n  }\n  return browser\n}\n\nasync function loadSources(): Promise<CorpusMeta[]> {\n  return await Bun.file('corpora/sources.json').json()\n}\n\nfunction parseOptions(): MatrixOptions {\n  const id = parseStringFlag('id')\n  if (id === null) {\n    throw new Error(`Missing --id. Available corpora: ${Object.keys(FONT_MATRIX).join(', ')}`)\n  }\n\n  const samples = parseOptionalNumberFlag('samples')\n  const start = parseNumberFlag('start', 300)\n  const end = parseNumberFlag('end', 900)\n  const step = parseNumberFlag('step', 10)\n  if (step <= 0) throw new Error('--step must be > 0')\n  if (end < start) throw new Error('--end must be >= --start')\n\n  return {\n    id,\n    browser: parseBrowser(parseStringFlag('browser')),\n    port: parseNumberFlag('port', Number.parseInt(process.env['CORPUS_CHECK_PORT'] ?? '0', 10)),\n    timeoutMs: parseNumberFlag('timeout', Number.parseInt(process.env['CORPUS_CHECK_TIMEOUT_MS'] ?? '180000', 10)),\n    output: parseStringFlag('output'),\n    samples,\n    start,\n    end,","sourceCodeStart":344,"sourceCodeEnd":380,"githubUrl":"https://github.com/chenglou/pretext/blob/ac49b09b7d83ede19581fa94a8b892b07d309baf/scripts/corpus-font-matrix.ts#L344-L380","documentation":"Thrown by parseOptions in corpus-font-matrix.ts when --id is absent. Distinct from [30]: the availability list here is `Object.keys(FONT_MATRIX).join(', ')` — the subset of corpora that have configured font variants, NOT the full corpora/sources.json list. A corpus present in sources.json but absent from FONT_MATRIX will not appear here, so the two error messages can list different ids.","triggerScenarios":"parseStringFlag('id') returns null inside parseOptions. The script then has no corpus to load font variants for, so it aborts before any I/O.","commonSituations":"Running corpus-font-matrix bare; assuming it iterates all corpora; confusing it with corpus-check whose availability list (sources.json) is broader.","solutions":["Pick an id from the FONT_MATRIX keys listed in the error and pass `--id=<key>`.","If the corpus you want is in sources.json but not in this list, it has no font variants configured — see [38] and add an entry to FONT_MATRIX.","Cross-check the printed list against the FONT_MATRIX constant near the top of corpus-font-matrix.ts."],"exampleFix":"// before\nbun run scripts/corpus-font-matrix.ts\n// after\nbun run scripts/corpus-font-matrix.ts --id=ja-kumo-no-ito","handlingStrategy":"validation","validationCode":"// Surface FONT_MATRIX keys before invoking corpus-font-matrix\nconst FONT_MATRIX_KEYS = Object.keys(FONT_MATRIX)\nfunction requireMatrixId(raw: string | null): string {\n  if (raw === null) {\n    throw new Error(`--id is required. Configured font-matrix corpora: ${FONT_MATRIX_KEYS.join(', ')}`)\n  }\n  return raw\n}","typeGuard":"function isFontMatrixId(id: string): boolean {\n  return Object.prototype.hasOwnProperty.call(FONT_MATRIX, id)\n}","tryCatchPattern":null,"preventionTips":["Pick --id from FONT_MATRIX keys (the error lists them), not from the broader sources.json list.","If a corpus is in sources.json but not listed here, it has no font variants — add some before sweeping.","Keep FONT_MATRIX and sources.json consistent when adding corpora."],"tags":["cli","validation","args","corpus-font-matrix"],"backgroundTag":null,"analyzedSha":"ac49b09b7d83ede19581fa94a8b892b07d309baf","analyzedAt":"2026-08-12T17:03:16.263Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}