chenglou/pretext · error · Error
Missing --id or --all. Available corpora: ${sources.map(sour
Error message
Missing --id or --all. Available corpora: ${sources.map(source => source.id).join(', ')} What it means
The sweep needs a target: either one corpus via `--id=` or all corpora via `--all`. Without either it throws, listing the available ids read from `corpora/sources.json`.
Source
Thrown at scripts/corpus-sweep.ts:248
encoding: 'utf8',
})
if (result.stdout.length > 0) process.stdout.write(result.stdout)
if (result.stderr.length > 0) process.stderr.write(result.stderr)
if (result.status !== 0) {
throw new Error(`corpus-check exited with status ${result.status ?? 'unknown'}`)
}
}
const options = parseOptions()
options.port = await getAvailablePort(options.port === 0 ? null : options.port)
const sources = await loadSources()
const targets = options.all
? sources
: (() => {
if (options.id === null) {
throw new Error(`Missing --id or --all. Available corpora: ${sources.map(source => source.id).join(', ')}`)
}
const meta = sources.find(source => source.id === options.id)
if (meta === undefined) {
throw new Error(`Unknown corpus ${options.id}. Available corpora: ${sources.map(source => source.id).join(', ')}`)
}
return [meta]
})()
const lock = await acquireBrowserAutomationLock(options.browser)
const session = createBrowserSession(options.browser)
let serverProcess: ChildProcess | null = null
const summaries: SweepSummary[] = []
try {
const pageServer = await ensurePageServer(options.port, '/corpus', process.cwd())
serverProcess = pageServer.process
const baseUrl = `${pageServer.baseUrl}/corpus`
View on GitHub (pinned to ac49b09b7d)
Solutions
- Add `--id=<corpusId>` using one of the ids printed in the message, or pass `--all`.
Example fix
// before bun run scripts/corpus-sweep.ts // after bun run scripts/corpus-sweep.ts --id=ja-kumo-no-ito // or sweep every corpus bun run scripts/corpus-sweep.ts --all
Defensive patterns
Strategy: validation
Validate before calling
if (options.id === null && !options.all) {
console.error(`Missing --id or --all. Available corpora: ${sources.map(s => s.id).join(', ')}`)
process.exit(2)
} Prevention
- Always pass either --id or --all in CI wrappers.
- Print sources with a --list mode if you script corpus selection dynamically.
When it happens
Trigger: `bun run scripts/corpus-sweep.ts` with no targeting flags.
Common situations: First-time use; forgetting the flag after adding a new corpus; a wrapper script that drops the id argument.
Related errors
- Invalid value for --${name}: ${raw}
- --step must be > 0
- Invalid value for --${name}: ${raw}
- Missing --id. Available corpora: ${sources.map(source => sou
- Invalid value for --${name}: ${raw}
AI-assisted analysis of chenglou/pretext@ac49b09b7d (2026-08-12).
Data as JSON: /api/errors/f32cfd37b35b9e35.
Report an issue: GitHub.