{"record":{"id":"be8425d2387da64d","repo":"chenglou/pretext","slug":"corpus-page-returned-error-for-meta-id-repor","errorCode":null,"errorMessage":"Corpus page returned error for ${meta.id}: ${report.message ?? 'unknown error'}","messagePattern":"Corpus page returned error for (.+?): (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/corpus-sweep.ts","lineNumber":295,"sourceCode":"    const reportServer = await startPostedReportServer<CorpusSweepReport>(requestId)\n    url += `&reportEndpoint=${encodeURIComponent(reportServer.endpoint)}`\n\n    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}: ${report.message ?? 'unknown error'}`)\n    }\n\n    const rows = getSweepRows(report, meta.id)\n    const mismatches: SweepMismatch[] = 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        predictedLineCount: row.predictedLineCount,\n        browserLineCount: row.browserLineCount,\n      }))\n    const exactCount = report.exactCount ?? (rows.length - mismatches.length)\n\n    const summary: SweepSummary = {\n      corpusId: meta.id,\n      language: meta.language,","sourceCodeStart":277,"sourceCodeEnd":313,"githubUrl":"https://github.com/chenglou/pretext/blob/ac49b09b7d83ede19581fa94a8b892b07d309baf/scripts/corpus-sweep.ts#L277-L313","documentation":"The in-page corpus harness posted a report with `status:'error'` and a `message`. This is the page itself reporting a failure (it couldn't load the corpus text, a measurement API threw, or the widths param was malformed).","triggerScenarios":"The `/corpus` page fails to fetch corpus content, a width in `&widths=` is invalid, or an in-page exception is caught and posted as an error report.","commonSituations":"Missing corpus source file; malformed `&widths`; a browser API error during measurement; wrong working directory so the page can't resolve assets; transient browser launch failure.","solutions":["Read `report.message` in the error text — it comes straight from the page and usually names the real cause.","Open the failing `/corpus?id=...&widths=...` URL in a headed browser and read the console.","Confirm the corpus source file exists and the dev server is serving `/corpus`.","Re-run; transient browser launch failures can surface as page errors."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  const report = await loadPostedReport(session, url, () => reportServer.waitForReport(null), requestId, options.browser, options.timeoutMs)\n  if (report.status === 'error') {\n    console.error(`page error for ${meta.id}: ${report.message ?? 'unknown'}; will retry once`)\n    // ... one retry of the navigation/POST, then surface if it persists\n  }\n} catch (err) {\n  // distinguish transport timeout from a genuine page-reported error\n}","preventionTips":["Read report.message first — it is the page's own diagnosis.","Confirm the dev server serves /corpus and the corpus source file resolves before automating.","Allow one retry for transient browser launch failures, then escalate to a headed inspection."],"tags":["corpus","sweep","browser-automation","page-error"],"backgroundTag":null,"analyzedSha":"ac49b09b7d83ede19581fa94a8b892b07d309baf","analyzedAt":"2026-08-12T17:03:16.263Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}