{"record":{"id":"789ebfe6e5e25cc2","repo":"chenglou/pretext","slug":"corpus-sweep-report-was-missing-rows-for-corpusi","errorCode":null,"errorMessage":"Corpus sweep report was missing rows for ${corpusId}","messagePattern":"Corpus sweep report was missing rows for (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/corpus-sweep.ts","lineNumber":200,"sourceCode":"    }\n  }\n\n  return [...buckets.entries()]\n    .sort((a, b) => a[0] - b[0])\n    .map(([diffPx, widths]) => `${diffPx > 0 ? '+' : ''}${diffPx}px: ${widths.join(', ')}`)\n    .join(' | ')\n}\n\nfunction printSummary(summary: SweepSummary): void {\n  console.log(\n    `${summary.corpusId} (${summary.language}) | ${summary.exactCount}/${summary.widthCount} exact | ${summary.mismatches.length} nonzero`,\n  )\n  console.log(`  ${bucketMismatches(summary.mismatches)}`)\n}\n\nfunction getSweepRows(report: CorpusSweepReport, corpusId: string): CorpusSweepRow[] {\n  if (report.rows === undefined) {\n    throw new Error(`Corpus sweep report was missing rows for ${corpusId}`)\n  }\n  return report.rows\n}\n\nfunction runDetailedDiagnose(meta: CorpusMeta, mismatches: SweepMismatch[], options: SweepOptions): void {\n  if (!options.diagnose || mismatches.length === 0) return\n\n  const widths = mismatches\n    .slice(0, options.diagnoseLimit)\n    .map(mismatch => String(mismatch.width))\n\n  console.log(`diagnosing ${meta.id} at ${widths.length} widths: ${widths.join(', ')}`)\n\n  const args = ['run', 'scripts/corpus-check.ts', `--id=${meta.id}`, '--diagnose', ...widths]\n  if (options.font !== null) {\n    args.push(`--font=${options.font}`)\n  }\n  if (options.lineHeight !== null) {","sourceCodeStart":182,"sourceCodeEnd":218,"githubUrl":"https://github.com/chenglou/pretext/blob/ac49b09b7d83ede19581fa94a8b892b07d309baf/scripts/corpus-sweep.ts#L182-L218","documentation":"Guard in `getSweepRows`: the browser page posted a report whose status is not 'error' but whose `rows` field is undefined. It prevents the downstream filter/map from treating undefined rows as an empty (all-exact) result.","triggerScenarios":"The `/corpus` page posts `{status:'ready'}` without `rows` — e.g., the widths list was empty after `min_width`/`max_width` clamping, or the POST payload was truncated on the side channel.","commonSituations":"Corpus width bounds in `corpora/sources.json` clamp the range to nothing; transport truncation; a stale page build that doesn't attach rows.","solutions":["Confirm the corpus width range overlaps `--start`/`--end` so the widths list is non-empty.","Re-run; if persistent, open the `/corpus?id=...&widths=...&report=1` URL headed and inspect console errors.","Raise `--timeout`; a slow measurement can post a ready report before rows are attached."],"exampleFix":"// before: corpus bounds exclude the whole sweep range\n// sources.json: { \"id\": \"x\", \"min_width\": 950 }\nbun run scripts/corpus-sweep.ts --id=x --start=300 --end=900\n// after\nbun run scripts/corpus-sweep.ts --id=x --start=900 --end=1200","handlingStrategy":"retry","validationCode":"const widths = getSweepWidths(meta, options)\nif (widths.length === 0) {\n  console.error(`No widths in range for ${meta.id}; skipping`)\n  continue\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Confirm corpus min_width/max_width overlaps --start/--end before sweeping.","Keep --timeout generous; a slow measurement can post a ready report without rows.","Treat a persistent missing-rows report as a page/transport bug and inspect the headed URL."],"tags":["corpus","sweep","browser-automation","report-transport"],"backgroundTag":null,"analyzedSha":"ac49b09b7d83ede19581fa94a8b892b07d309baf","analyzedAt":"2026-08-12T17:03:16.263Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}