chenglou/pretext · error · Error
${batchReport.message ?? 'pre-wrap batch failed'}
Error message
${batchReport.message ?? 'pre-wrap batch failed'} What it means
runBrowser() inspects the posted ProbeBatchReport from the /probe?batch=pre-wrap page; if status is 'error', it re-throws wrapped with batchReport.message (or the generic 'pre-wrap batch failed'). The originating failure is inside the browser probe page, surfaced by this CLI.
Source
Thrown at scripts/pre-wrap-check.ts:130
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=pre-wrap` +
`&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 ?? 'pre-wrap batch failed')
}
const batchResults = batchReport.results ?? []
const reportsByLabel = new Map(batchResults.map(result => [result.label, result.report]))
for (const testCase of PRE_WRAP_ORACLE_CASES) {
const report = reportsByLabel.get(testCase.label)
if (report === undefined) {
throw new Error(`Missing pre-wrap result for ${testCase.label}`)
}
printCaseResult(browser, testCase, report)
if (!reportIsExact(report)) ok = false
}
} finally {
reportServer.close()
}
} finally {
session?.close()
serverProcess?.kill()View on GitHub (pinned to ac49b09b7d)
Solutions
- Read the wrapped batchReport.message for the browser-side root cause.
- Confirm the probe page server is healthy; suspect stale tabs/servers before assuming an engine bug (per repo guidance).
- Raise `--timeout=` if the message indicates a measurement timeout.
- Reproduce the failing case on 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('pre-wrap batch failed') || /pre-wrap/i.test(msg)) {
console.error(`Probe batch error for ${browser}. Suspect stale tabs/servers first; see message: ${msg}`)
process.exit(1)
}
throw e
} Prevention
- Don't run concurrent automation jobs against the same browser (single-owner lock).
- Suspect stale tabs/servers first; raise --timeout before assuming a regression.
When it happens
Trigger: The pre-wrap probe page threw during measurement, could not measure a case (e.g. tab/space/hard-break handling), or explicitly reported status='error'. Common with an unhealthy page server, a throttled/backgrounded tab, or a regression in the probe page.
Common situations: Transient automation flakiness, dev server not running, stale tabs/servers, or a real regression in pre-wrap handling.
Related errors
- ${batchReport.message ?? 'keep-all batch failed'}
- ${batchReport.message ?? 'letter-spacing batch failed'}
- Missing keep-all result for ${testCase.label}
- Missing letter-spacing result for ${testCase.label}
- Timed out waiting for local port ${port}
AI-assisted analysis of chenglou/pretext@ac49b09b7d (2026-08-12).
Data as JSON: /api/errors/46cdafdd46e6a7fc.
Report an issue: GitHub.