chenglou/pretext · error · Error

Corpus page returned error for ${meta.id}: ${report.message

Error message

Corpus page returned error for ${meta.id}: ${report.message ?? 'unknown error'}

What it means

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).

Source

Thrown at scripts/corpus-sweep.ts:295

    const reportServer = await startPostedReportServer<CorpusSweepReport>(requestId)
    url += `&reportEndpoint=${encodeURIComponent(reportServer.endpoint)}`

    const report = await (async () => {
      try {
        return await loadPostedReport(
          session,
          url,
          () => reportServer.waitForReport(null),
          requestId,
          options.browser,
          options.timeoutMs,
        )
      } finally {
        reportServer.close()
      }
    })()
    if (report.status === 'error') {
      throw new Error(`Corpus page returned error for ${meta.id}: ${report.message ?? 'unknown error'}`)
    }

    const rows = getSweepRows(report, meta.id)
    const mismatches: SweepMismatch[] = rows
      .filter(row => Math.round(row.diffPx) !== 0)
      .map(row => ({
        width: row.width,
        diffPx: Math.round(row.diffPx),
        predictedHeight: Math.round(row.predictedHeight),
        actualHeight: Math.round(row.actualHeight),
        predictedLineCount: row.predictedLineCount,
        browserLineCount: row.browserLineCount,
      }))
    const exactCount = report.exactCount ?? (rows.length - mismatches.length)

    const summary: SweepSummary = {
      corpusId: meta.id,
      language: meta.language,

View on GitHub (pinned to ac49b09b7d)

Solutions

  1. Read `report.message` in the error text — it comes straight from the page and usually names the real cause.
  2. Open the failing `/corpus?id=...&widths=...` URL in a headed browser and read the console.
  3. Confirm the corpus source file exists and the dev server is serving `/corpus`.
  4. Re-run; transient browser launch failures can surface as page errors.
Defensive patterns

Strategy: retry

Try / catch

try {
  const report = await loadPostedReport(session, url, () => reportServer.waitForReport(null), requestId, options.browser, options.timeoutMs)
  if (report.status === 'error') {
    console.error(`page error for ${meta.id}: ${report.message ?? 'unknown'}; will retry once`)
    // ... one retry of the navigation/POST, then surface if it persists
  }
} catch (err) {
  // distinguish transport timeout from a genuine page-reported error
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of chenglou/pretext@ac49b09b7d (2026-08-12). Data as JSON: /api/errors/be8425d2387da64d. Report an issue: GitHub.