{"record":{"id":"980f3baf3fe17f24","repo":"chenglou/pretext","slug":"samples-is-obsolete-for-corpus-sweep-use-the-de","errorCode":null,"errorMessage":"--samples is obsolete for corpus-sweep; use the default step-based sweep or sampled font-matrix/taxonomy runs instead","messagePattern":"--samples is obsolete for corpus-sweep; use the default step-based sweep or sampled font-matrix/taxonomy runs instead","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/corpus-sweep.ts","lineNumber":130,"sourceCode":"  const browser = (value ?? process.env['CORPUS_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\nasync function loadSources(): Promise<CorpusMeta[]> {\n  return await Bun.file('corpora/sources.json').json()\n}\n\nfunction parseOptions(): SweepOptions {\n  const start = parseNumberFlag('start', 300)\n  const end = parseNumberFlag('end', 900)\n  const step = parseNumberFlag('step', 10)\n  if (step <= 0) throw new Error('--step must be > 0')\n  if (end < start) throw new Error('--end must be >= --start')\n  if (parseStringFlag('samples') !== null) {\n    throw new Error('--samples is obsolete for corpus-sweep; use the default step-based sweep or sampled font-matrix/taxonomy runs instead')\n  }\n\n  return {\n    id: parseStringFlag('id'),\n    all: hasFlag('all'),\n    start,\n    end,\n    step,\n    port: parseNumberFlag('port', Number.parseInt(process.env['CORPUS_CHECK_PORT'] ?? '0', 10)),\n    browser: parseBrowser(parseStringFlag('browser')),\n    output: parseStringFlag('output'),\n    timeoutMs: parseNumberFlag('timeout', Number.parseInt(process.env['CORPUS_CHECK_TIMEOUT_MS'] ?? '180000', 10)),\n    font: parseStringFlag('font'),\n    lineHeight: parseOptionalNumberFlag('lineHeight'),\n    diagnose: hasFlag('diagnose'),\n    diagnoseLimit: parseNumberFlag('diagnose-limit', 6),\n  }\n}","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/chenglou/pretext/blob/ac49b09b7d83ede19581fa94a8b892b07d309baf/scripts/corpus-sweep.ts#L112-L148","documentation":"The sweep used to accept `--samples` for randomized width selection; that mode was removed in favor of the deterministic step-based sweep. Passing `--samples` now hard-fails to prevent silent misinterpretation of old invocations.","triggerScenarios":"Re-running an old command or CI line that still includes `--samples=N` against `corpus-sweep.ts`.","commonSituations":"Stale CI/shell history after upgrading; muscle memory from the old sampled sweep mode.","solutions":["Drop `--samples`; rely on the default step sweep (`--start`/`--end`/`--step`).","If you specifically need sampling, use `corpus-taxonomy.ts --samples=N` or `corpus-font-matrix.ts --samples=N`, which still accept it."],"exampleFix":"// before\nbun run scripts/corpus-sweep.ts --id=ja-kumo-no-ito --samples=12\n// after\nbun run scripts/corpus-sweep.ts --id=ja-kumo-no-ito                 // step sweep\nbun run scripts/corpus-taxonomy.ts --id=ja-kumo-no-ito --samples=12 // sampling kept here","handlingStrategy":"validation","validationCode":"if (parseStringFlag('samples') !== null) {\n  console.error('--samples is not accepted by corpus-sweep; use corpus-taxonomy or corpus-font-matrix for sampling')\n  process.exit(2)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Audit CI/shell history for --samples when upgrading corpus-sweep.","Route sampling needs to corpus-taxonomy --samples or corpus-font-matrix --samples."],"tags":["cli","deprecated","migration","validation"],"backgroundTag":null,"analyzedSha":"ac49b09b7d83ede19581fa94a8b892b07d309baf","analyzedAt":"2026-08-12T17:03:16.263Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}