chenglou/pretext · error · Error

${batchReport.message ?? 'letter-spacing batch failed'}

Error message

${batchReport.message ?? 'letter-spacing batch failed'}

What it means

runBrowser() inspects the posted ProbeBatchReport from the /probe?batch=letter-spacing page; if status is 'error', it re-throws wrapped in this message (using batchReport.message or the generic fallback). The actual failure originated in the browser page, and this CLI only surfaces it.

Source

Thrown at scripts/letter-spacing-check.ts:230

    serverProcess = pageServer.process
    const requestId = `${browser}-${Date.now()}-${Math.random().toString(36).slice(2)}`
    const reportServer = await startPostedReportServer<ProbeBatchReport>(requestId)

    try {
      const url =
        `${pageServer.baseUrl}/probe?batch=letter-spacing` +
        `&requestId=${encodeURIComponent(requestId)}` +
        `&reportEndpoint=${encodeURIComponent(reportServer.endpoint)}`
      const batchReport = await loadPostedReport(
        session,
        url,
        () => reportServer.waitForReport(null),
        requestId,
        reportBrowser,
        timeoutMs,
      )
      if (batchReport.status === 'error') {
        throw new Error(batchReport.message ?? 'letter-spacing batch failed')
      }

      const batchResults = batchReport.results ?? []
      const reportsByLabel = new Map(batchResults.map(result => [result.label, result.report]))
      for (const testCase of LETTER_SPACING_ORACLE_CASES) {
        const report = reportsByLabel.get(testCase.label)
        if (report === undefined) {
          throw new Error(`Missing letter-spacing result for ${testCase.label}`)
        }
        printCaseResult(browser, testCase, report)
        results.push(toOracleResult(browser, testCase, report))
      }
    } finally {
      reportServer.close()
    }
  } finally {
    session?.close()
    serverProcess?.kill()

View on GitHub (pinned to ac49b09b7d)

Solutions

  1. Read the wrapped batchReport.message for the browser-side root cause.
  2. Confirm the probe page server is healthy; suspect stale tabs/servers before assuming an engine bug (per repo guidance).
  3. Raise `--timeout=` if the message points at a measurement timeout.
  4. Reproduce the failing case in the diagnostic /probe page to localize.
Defensive patterns

Strategy: try-catch

Type guard

const isBatchError = (r: { status?: string }): boolean => r.status === 'error'

Try / catch

try {
  await runBrowser(browser, port)
} catch (e) {
  const msg = e instanceof Error ? e.message : String(e)
  if (msg.includes('letter-spacing batch failed') || /letter-spacing/i.test(msg)) {
    console.error(`Probe batch error for ${browser}. Suspect stale tabs/servers first; see message: ${msg}`)
    process.exit(1)
  }
  throw e
}

Prevention

When it happens

Trigger: The letter-spacing probe page threw during measurement, could not measure a case, or explicitly reported status='error'. Common with an unhealthy page server, a throttled/backgrounded automation tab, or a regression in the probe page.

Common situations: Transient automation flakiness, dev server not up, stale tabs/servers, or a real regression in the probe page.

Related errors


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