{"record":{"id":"6748bd3ee172e0e9","repo":"chenglou/pretext","slug":"unknown-corpus-options-id-available-corpora-6748bd","errorCode":null,"errorMessage":"Unknown corpus ${options.id}. Available corpora: ${sources.map(source => source.id).join(', ')}","messagePattern":"Unknown corpus (.+?)\\. Available corpora: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/corpus-sweep.ts","lineNumber":252,"sourceCode":"  if (result.stderr.length > 0) process.stderr.write(result.stderr)\n  if (result.status !== 0) {\n    throw new Error(`corpus-check exited with status ${result.status ?? 'unknown'}`)\n  }\n}\n\nconst options = parseOptions()\noptions.port = await getAvailablePort(options.port === 0 ? null : options.port)\nconst sources = await loadSources()\n\nconst targets = options.all\n  ? sources\n  : (() => {\n      if (options.id === null) {\n        throw new Error(`Missing --id or --all. Available corpora: ${sources.map(source => source.id).join(', ')}`)\n      }\n      const meta = sources.find(source => source.id === options.id)\n      if (meta === undefined) {\n        throw new Error(`Unknown corpus ${options.id}. Available corpora: ${sources.map(source => source.id).join(', ')}`)\n      }\n      return [meta]\n    })()\n\nconst lock = await acquireBrowserAutomationLock(options.browser)\nconst session = createBrowserSession(options.browser)\nlet serverProcess: ChildProcess | null = null\nconst summaries: SweepSummary[] = []\n\ntry {\n  const pageServer = await ensurePageServer(options.port, '/corpus', process.cwd())\n  serverProcess = pageServer.process\n  const baseUrl = `${pageServer.baseUrl}/corpus`\n\n  for (const meta of targets) {\n    const widths = getSweepWidths(meta, options)\n    const requestId = `${Date.now()}-${meta.id}-${Math.random().toString(36).slice(2)}`\n    let url =","sourceCodeStart":234,"sourceCodeEnd":270,"githubUrl":"https://github.com/chenglou/pretext/blob/ac49b09b7d83ede19581fa94a8b892b07d309baf/scripts/corpus-sweep.ts#L234-L270","documentation":"`--id` was supplied but no entry in `corpora/sources.json` matches it. The error lists the valid ids so the operator can copy a correct one.","triggerScenarios":"`--id=ja-kumo` (misspelled/truncated) or referencing an id that was renamed or removed from sources.json.","commonSituations":"Typo; stale command after a corpus id rename; `corpora/sources.json` not regenerated after adding a corpus.","solutions":["Copy a valid id verbatim from the error's list.","If you expected the id to exist, inspect `corpora/sources.json` for a rename or missing entry."],"exampleFix":"// before\nbun run scripts/corpus-sweep.ts --id=ja-kumo\n// after\nbun run scripts/corpus-sweep.ts --id=ja-kumo-no-ito","handlingStrategy":"validation","validationCode":"const validIds = new Set(sources.map(s => s.id))\nif (options.id !== null && !validIds.has(options.id)) {\n  console.error(`Unknown corpus ${options.id}. Available: ${[...validIds].join(', ')}`)\n  process.exit(2)\n}","typeGuard":"const isKnownCorpus = (id: string, sources: CorpusMeta[]): id is string =>\n  sources.some(s => s.id === id)","tryCatchPattern":null,"preventionTips":["Copy corpus ids verbatim from sources.json rather than typing from memory.","Re-check ids after renaming or adding a corpus."],"tags":["cli","validation","corpus","config"],"backgroundTag":null,"analyzedSha":"ac49b09b7d83ede19581fa94a8b892b07d309baf","analyzedAt":"2026-08-12T17:03:16.263Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}