{"record":{"id":"51502c24eebe8223","repo":"chenglou/pretext","slug":"missing-name","errorCode":null,"errorMessage":"Missing --${name}=...","messagePattern":"Missing --(.+?)=\\.\\.\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/probe-check.ts","lineNumber":89,"sourceCode":"function parseNumberFlag(name: string, fallback: number): number {\n  const raw = parseStringFlag(name)\n  if (raw === null) return fallback\n  const parsed = Number.parseInt(raw, 10)\n  if (!Number.isFinite(parsed)) throw new Error(`Invalid value for --${name}: ${raw}`)\n  return parsed\n}\n\nfunction parseBrowser(value: string | null): BrowserKind {\n  const browser = (value ?? process.env['PROBE_CHECK_BROWSER'] ?? 'chrome').toLowerCase()\n  if (browser !== 'chrome' && browser !== 'safari') {\n    throw new Error(`Unsupported browser ${browser}; expected chrome or safari`)\n  }\n  return browser\n}\n\nfunction requireFlag(name: string): string {\n  const value = parseStringFlag(name)\n  if (value === null || value.length === 0) throw new Error(`Missing --${name}=...`)\n  return value\n}\n\nfunction printReport(report: ProbeReport): void {\n  if (report.status === 'error') {\n    console.log(`error: ${report.message ?? 'unknown error'}`)\n    return\n  }\n\n  console.log(\n    `width ${report.width}: diff ${report.diffPx}px | lines ${report.predictedLineCount}/${report.browserLineCount} | height ${report.predictedHeight}/${report.actualHeight}`,\n  )\n  if (report.browserLineMethod !== undefined) {\n    console.log(`  browser line method: ${report.browserLineMethod}`)\n  }\n  if (report.extractorSensitivity !== null && report.extractorSensitivity !== undefined) {\n    console.log(`  extractor sensitivity: ${report.extractorSensitivity}`)\n  }","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/chenglou/pretext/blob/ac49b09b7d83ede19581fa94a8b892b07d309baf/scripts/probe-check.ts#L71-L107","documentation":"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.","triggerScenarios":"Run probe-check without --text=...; pass --text= (empty); use space form (--text hi) which is parsed as a positional and ignored.","commonSituations":"First-time use; assuming --text has a default; a shell that splits --text= from its value.","solutions":["Pass --text=<your string>.","Ensure the value is non-empty after the =.","Quote strings with spaces: --text=\"hello world\"."],"exampleFix":"# before\nbun run scripts/probe-check.ts --width=600\n\n# after\nbun run scripts/probe-check.ts --text=\"hello world\" --width=600","handlingStrategy":"validation","validationCode":"const hasRequiredFlag = (name: string): boolean => {\n  const v = parseStringFlag(name)\n  return v !== null && v.length > 0\n}\nif (!hasRequiredFlag('text')) {\n  console.error('probe-check requires --text=<string>')\n  process.exit(2)\n}","typeGuard":"const hasRequiredFlag = (name: string): boolean => {\n  const v = parseStringFlag(name)\n  return v !== null && v.length > 0\n}","tryCatchPattern":null,"preventionTips":["--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\"."],"tags":["cli","argument-parsing"],"backgroundTag":null,"analyzedSha":"ac49b09b7d83ede19581fa94a8b892b07d309baf","analyzedAt":"2026-08-12T17:03:16.263Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}