chenglou/pretext · error · Error
Missing --${name}=...
Error message
Missing --${name}=... What it means
requireFlag reads a mandatory --<name>=<value> flag and throws when it is absent or empty. Currently the only required flag is --text (line 147): the probe checker must have a string to measure. The parser only recognizes the --name=value form, so space-separated --text hello will not be picked up.
Source
Thrown at scripts/probe-check.ts:89
function parseNumberFlag(name: string, fallback: number): number {
const raw = parseStringFlag(name)
if (raw === null) return fallback
const parsed = Number.parseInt(raw, 10)
if (!Number.isFinite(parsed)) throw new Error(`Invalid value for --${name}: ${raw}`)
return parsed
}
function parseBrowser(value: string | null): BrowserKind {
const browser = (value ?? process.env['PROBE_CHECK_BROWSER'] ?? 'chrome').toLowerCase()
if (browser !== 'chrome' && browser !== 'safari') {
throw new Error(`Unsupported browser ${browser}; expected chrome or safari`)
}
return browser
}
function requireFlag(name: string): string {
const value = parseStringFlag(name)
if (value === null || value.length === 0) throw new Error(`Missing --${name}=...`)
return value
}
function printReport(report: ProbeReport): void {
if (report.status === 'error') {
console.log(`error: ${report.message ?? 'unknown error'}`)
return
}
console.log(
`width ${report.width}: diff ${report.diffPx}px | lines ${report.predictedLineCount}/${report.browserLineCount} | height ${report.predictedHeight}/${report.actualHeight}`,
)
if (report.browserLineMethod !== undefined) {
console.log(` browser line method: ${report.browserLineMethod}`)
}
if (report.extractorSensitivity !== null && report.extractorSensitivity !== undefined) {
console.log(` extractor sensitivity: ${report.extractorSensitivity}`)
}View on GitHub (pinned to ac49b09b7d)
Solutions
- Pass --text=<your string>.
- Ensure the value is non-empty after the =.
- Quote strings with spaces: --text="hello world".
Example fix
# before bun run scripts/probe-check.ts --width=600 # after bun run scripts/probe-check.ts --text="hello world" --width=600
Defensive patterns
Strategy: validation
Validate before calling
const hasRequiredFlag = (name: string): boolean => {
const v = parseStringFlag(name)
return v !== null && v.length > 0
}
if (!hasRequiredFlag('text')) {
console.error('probe-check requires --text=<string>')
process.exit(2)
} Type guard
const hasRequiredFlag = (name: string): boolean => {
const v = parseStringFlag(name)
return v !== null && v.length > 0
} Prevention
- --text is mandatory and has no default; always provide --text=<value>.
- Use the = form: space-separated --text hello is not parsed.
- Quote multi-word values: --text="hello world".
When it happens
Trigger: Run probe-check without --text=...; pass --text= (empty); use space form (--text hi) which is parsed as a positional and ignored.
Common situations: First-time use; assuming --text has a default; a shell that splits --text= from its value.
Related errors
- Invalid value for --${name}: ${raw}
- --step must be > 0
- Missing --id or --all. Available corpora: ${sources.map(sour
- Invalid value for --${name}: ${raw}
- Missing --id. Available corpora: ${sources.map(source => sou
AI-assisted analysis of chenglou/pretext@ac49b09b7d (2026-08-12).
Data as JSON: /api/errors/51502c24eebe8223.
Report an issue: GitHub.