chenglou/pretext · error · Error

Missing --id. Available corpora: ${sources.map(source => sou

Error message

Missing --id. Available corpora: ${sources.map(source => source.id).join(', ')}

What it means

The taxonomy script always targets a single corpus (there is no `--all`). Without `--id` it throws, listing the available ids from `corpora/sources.json`.

Source

Thrown at scripts/corpus-taxonomy.ts:188

      )
    }
  }
}

const browser = parseBrowser(parseStringFlag('browser'))
const requestedPort = parseNumberFlag('port', Number.parseInt(process.env['CORPUS_CHECK_PORT'] ?? '0', 10))
const timeoutMs = parseNumberFlag('timeout', Number.parseInt(process.env['CORPUS_CHECK_TIMEOUT_MS'] ?? '180000', 10))
const start = parseNumberFlag('start', 300)
const end = parseNumberFlag('end', 900)
const step = parseNumberFlag('step', 10)
const samples = parseOptionalNumberFlag('samples')
const font = parseStringFlag('font')
const lineHeight = parseOptionalNumberFlag('lineHeight')
const id = parseStringFlag('id')

const sources = await loadSources()
if (id === null) {
  throw new Error(`Missing --id. Available corpora: ${sources.map(source => source.id).join(', ')}`)
}
const meta = sources.find(source => source.id === id)
if (meta === undefined) {
  throw new Error(`Unknown corpus ${id}. Available corpora: ${sources.map(source => source.id).join(', ')}`)
}

const widths = getTargetWidths(meta, start, end, step, samples)
const lock = await acquireBrowserAutomationLock(browser)
const session = createBrowserSession(browser)
let serverProcess: ChildProcess | null = null

try {
  const port = await getAvailablePort(requestedPort === 0 ? null : requestedPort)
  const pageServer = await ensurePageServer(port, '/corpus', process.cwd())
  serverProcess = pageServer.process
  const baseUrl = `${pageServer.baseUrl}/corpus`
  const entries: TaxonomyEntry[] = []

View on GitHub (pinned to ac49b09b7d)

Solutions

  1. Add `--id=<corpusId>` using one of the ids printed in the message.

Example fix

// before
bun run scripts/corpus-taxonomy.ts
// after
bun run scripts/corpus-taxonomy.ts --id=ja-kumo-no-ito
Defensive patterns

Strategy: validation

Validate before calling

if (id === null) {
  console.error(`Missing --id. Available corpora: ${sources.map(s => s.id).join(', ')}`)
  process.exit(2)
}

Prevention

When it happens

Trigger: `bun run scripts/corpus-taxonomy.ts` with no `--id` flag.

Common situations: First-time use; a wrapper that drops the id; assuming `--all` exists here as it does in the sweep.

Related errors


AI-assisted analysis of chenglou/pretext@ac49b09b7d (2026-08-12). Data as JSON: /api/errors/27e1c8c46ea1c6f9. Report an issue: GitHub.