chenglou/pretext · error · Error
--step must be > 0
Error message
--step must be > 0
What it means
Thrown after `--step` parses as a valid integer but is zero or negative. The sweep loop increments width by `step`, so a non-positive step would loop forever or make no progress.
Source
Thrown at scripts/corpus-sweep.ts:127
}
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(): SweepOptions {
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')
if (parseStringFlag('samples') !== null) {
throw new Error('--samples is obsolete for corpus-sweep; use the default step-based sweep or sampled font-matrix/taxonomy runs instead')
}
return {
id: parseStringFlag('id'),
all: hasFlag('all'),
start,
end,
step,
port: parseNumberFlag('port', Number.parseInt(process.env['CORPUS_CHECK_PORT'] ?? '0', 10)),
browser: parseBrowser(parseStringFlag('browser')),
output: parseStringFlag('output'),
timeoutMs: parseNumberFlag('timeout', Number.parseInt(process.env['CORPUS_CHECK_TIMEOUT_MS'] ?? '180000', 10)),
font: parseStringFlag('font'),
lineHeight: parseOptionalNumberFlag('lineHeight'),
diagnose: hasFlag('diagnose'),View on GitHub (pinned to ac49b09b7d)
Solutions
- Pass a positive step, e.g. `--step=10` (the default).
- If you want a single width, use the taxonomy/check script with a positional width instead of zeroing the step.
Example fix
// before bun run scripts/corpus-sweep.ts --id=ja-kumo-no-ito --step=0 // after bun run scripts/corpus-sweep.ts --id=ja-kumo-no-ito --step=10
Defensive patterns
Strategy: validation
Validate before calling
const step = parseNumberFlag('step', 10)
if (step <= 0) {
console.error('--step must be > 0')
process.exit(2)
} Prevention
- Keep --step at its default (10) unless you have a reason to change it.
- For single-width checks, pass the width positionally to the taxonomy/check script instead of zeroing the step.
When it happens
Trigger: `--step=0` or `--step=-10`.
Common situations: Trying to disable stepping; a sign error; copy-pasting a value intended for a different flag.
Related errors
- Invalid value for --${name}: ${raw}
- Missing --id or --all. Available corpora: ${sources.map(sour
- 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/2f39f335337bc2d1.
Report an issue: GitHub.