chenglou/pretext · error · Error
Missing --id. Available corpora: ${Object.keys(FONT_MATRIX).
Error message
Missing --id. Available corpora: ${Object.keys(FONT_MATRIX).join(', ')} What it means
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.
Source
Thrown at scripts/corpus-font-matrix.ts:362
return parsed
}
function parseBrowser(value: string | null): BrowserKind {
const browser = (value ?? process.env['CORPUS_CHECK_BROWSER'] ?? 'chrome').toLowerCase()
if (browser !== 'chrome' && browser !== 'safari') {
throw new Error(`Unsupported browser ${browser}; expected chrome or safari`)
}
return browser
}
async function loadSources(): Promise<CorpusMeta[]> {
return await Bun.file('corpora/sources.json').json()
}
function parseOptions(): MatrixOptions {
const id = parseStringFlag('id')
if (id === null) {
throw new Error(`Missing --id. Available corpora: ${Object.keys(FONT_MATRIX).join(', ')}`)
}
const samples = parseOptionalNumberFlag('samples')
const start = parseNumberFlag('start', 300)
const end = parseNumberFlag('end', 900)
const step = parseNumberFlag('step', 10)
if (step <= 0) throw new Error('--step must be > 0')
if (end < start) throw new Error('--end must be >= --start')
return {
id,
browser: parseBrowser(parseStringFlag('browser')),
port: parseNumberFlag('port', Number.parseInt(process.env['CORPUS_CHECK_PORT'] ?? '0', 10)),
timeoutMs: parseNumberFlag('timeout', Number.parseInt(process.env['CORPUS_CHECK_TIMEOUT_MS'] ?? '180000', 10)),
output: parseStringFlag('output'),
samples,
start,
end,View on GitHub (pinned to ac49b09b7d)
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.
Example fix
// before bun run scripts/corpus-font-matrix.ts // after bun run scripts/corpus-font-matrix.ts --id=ja-kumo-no-ito
Defensive patterns
Strategy: validation
Validate before calling
// Surface FONT_MATRIX keys before invoking corpus-font-matrix
const FONT_MATRIX_KEYS = Object.keys(FONT_MATRIX)
function requireMatrixId(raw: string | null): string {
if (raw === null) {
throw new Error(`--id is required. Configured font-matrix corpora: ${FONT_MATRIX_KEYS.join(', ')}`)
}
return raw
} Type guard
function isFontMatrixId(id: string): boolean {
return Object.prototype.hasOwnProperty.call(FONT_MATRIX, id)
} Prevention
- 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.
When it happens
Trigger: parseStringFlag('id') returns null inside parseOptions. The script then has no corpus to load font variants for, so it aborts before any I/O.
Common situations: Running corpus-font-matrix bare; assuming it iterates all corpora; confusing it with corpus-check whose availability list (sources.json) is broader.
Related errors
- Invalid value for --${name}: ${raw}
- --step must be > 0
- Unknown corpus ${options.id}. Available corpora: ${sources.m
- Invalid value for --${name}: ${raw}
- Unsupported --method ${requestedMethod}; expected span or ra
AI-assisted analysis of chenglou/pretext@ac49b09b7d (2026-08-12).
Data as JSON: /api/errors/bb296ca43cc06258.
Report an issue: GitHub.