{"record":{"id":"5d4cb54e0004886b","repo":"chenglou/pretext","slug":"corpus-font-matrix-report-was-missing-rows-for-m","errorCode":null,"errorMessage":"Corpus font matrix report was missing rows for ${meta.id} (${variant.id})","messagePattern":"Corpus font matrix report was missing rows for (.+?) \\((.+?)\\)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/corpus-font-matrix.ts","lineNumber":487,"sourceCode":"    const report = await (async () => {\n      try {\n        return await loadPostedReport(\n          session,\n          url,\n          () => reportServer.waitForReport(null),\n          requestId,\n          options.browser,\n          options.timeoutMs,\n        )\n      } finally {\n        reportServer.close()\n      }\n    })()\n    if (report.status === 'error') {\n      throw new Error(`Corpus page returned error for ${meta.id} (${variant.id}): ${report.message ?? 'unknown error'}`)\n    }\n    if (report.rows === undefined) {\n      throw new Error(`Corpus font matrix report was missing rows for ${meta.id} (${variant.id})`)\n    }\n\n    const mismatches: VariantResult['mismatches'] = report.rows\n      .filter(row => Math.round(row.diffPx) !== 0)\n      .map(row => ({\n        width: row.width,\n        diffPx: Math.round(row.diffPx),\n        predictedHeight: Math.round(row.predictedHeight),\n        actualHeight: Math.round(row.actualHeight),\n      }))\n    const exactCount = report.exactCount ?? (report.rows.length - mismatches.length)\n\n    variantResults.push({\n      id: variant.id,\n      label: variant.label,\n      font: variant.font,\n      lineHeight: variant.lineHeight,\n      widthCount: report.rows.length,","sourceCodeStart":469,"sourceCodeEnd":505,"githubUrl":"https://github.com/chenglou/pretext/blob/ac49b09b7d83ede19581fa94a8b892b07d309baf/scripts/corpus-font-matrix.ts#L469-L505","documentation":"Thrown by the font-matrix sweep after a browser corpus page posts a 'ready' report that omits the `rows` array for the current font variant. It guards against silently treating an empty/partial measurement as zero mismatches. The page either measured no width or the POST side channel delivered an incomplete payload.","triggerScenarios":"Run `bun run scripts/corpus-font-matrix.ts --id=...` and the in-page harness posts `{status:'ready'}` with no `rows`. Typical causes: the `&widths=` list resolved to nothing because the corpus `min_width`/`max_width` clamped the range empty, the page threw before building rows, or the POST side channel truncated the payload.","commonSituations":"A corpus's `min_width`/`max_width` in `corpora/sources.json` excludes every width in the `--start`/`--end` sweep range; a stale `/corpus` page build that doesn't emit rows for the requested font variant; a reportEndpoint POST that drops the rows field under a firewall or timeout.","solutions":["Re-run the matrix; if it persists, open the same `/corpus?id=...&widths=...&font=...&lineHeight=...&report=1` URL in a headed browser and read the console for in-page errors.","Check that the corpus's `min_width`/`max_width` in `corpora/sources.json` overlaps your `--start`/`--end` range; a clamped-empty width list yields no rows.","Raise `--timeout` (or `CORPUS_CHECK_TIMEOUT_MS`); a measurement exceeding the timeout can post a 'ready' report before rows attach.","Confirm the POST side channel (reportEndpoint) is reachable from the page; a blocked endpoint can drop the rows field."],"exampleFix":"// before: corpus min_width clamps the sweep range empty\n// corpora/sources.json: { \"id\": \"x\", \"min_width\": 950 }\n// invocation:  --start=300 --end=900  -> no widths in range -> no rows\n\n// after: widen the sweep to overlap the corpus bounds\nbun run scripts/corpus-font-matrix.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}; adjust --start/--end or corpus min_width/max_width`)\n  process.exit(0)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Verify the corpus width range (min_width/max_width in sources.json) overlaps --start/--end before running a font matrix.","Keep --timeout generous for large font matrices.","Ensure the reportEndpoint POST side channel is reachable from the page."],"tags":["corpus","font-matrix","browser-automation","report-transport"],"backgroundTag":null,"analyzedSha":"ac49b09b7d83ede19581fa94a8b892b07d309baf","analyzedAt":"2026-08-12T17:03:16.263Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}