chenglou/pretext · error · Error

${batchReport.message ?? 'keep-all batch failed'}

Error message

${batchReport.message ?? 'keep-all batch failed'}

What it means

After the in-page keep-all probe batch reports back via the POST side channel, runBrowser() inspects batchReport.status. If the page set status to 'error', this wraps batchReport.message (falling back to a generic 'keep-all batch failed'). The root cause lives in the browser page that ran the probe, not in this CLI process.

Source

Thrown at scripts/keep-all-check.ts:151

    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=keep-all` +
        `&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 ?? 'keep-all batch failed')
      }

      const batchResults = batchReport.results ?? []
      const reportsByLabel = new Map(batchResults.map(result => [result.label, result.report]))
      for (const testCase of KEEP_ALL_ORACLE_CASES) {
        if (!caseRunsInBrowser(testCase, browser)) continue
        const report = reportsByLabel.get(testCase.label)
        if (report === undefined) {
          throw new Error(`Missing keep-all result for ${testCase.label}`)
        }
        printCaseResult(browser, testCase, report)
        if (!reportIsExact(report)) ok = false
      }
    } finally {
      reportServer.close()
    }
  } finally {
    session?.close()

View on GitHub (pinned to ac49b09b7d)

Solutions

  1. Read the wrapped batchReport.message printed in the error for the browser-side root cause.
  2. Confirm the dev/probe page server is healthy and re-run; suspect stale tabs/servers before assuming an engine bug (per repo guidance).
  3. Re-run with `--timeout=` raised if the message indicates a measurement timeout.
  4. If the message points at a specific probe case, debug that case in isolation via the diagnostic /probe page.
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('keep-all batch failed') || msg.startsWith('keep-all')) {
    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 /probe?batch=keep-all page threw during measurement, failed to acquire a measurement, hit a DOM/layout error, or returned an explicit error status in the posted ProbeBatchReport. Possible when the test server didn't serve the probe page, the automation tab was backgrounded/throttled, or a probe case references text the page cannot render.

Common situations: A transient browser-automation hiccup, the dev server not running on the expected port, stale tab/server, or a regression in the probe page itself.

Related errors


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