{"record":{"id":"7af615902f326fa1","repo":"chenglou/pretext","slug":"batchreport-message-keep-all-batch-failed","errorCode":null,"errorMessage":"${batchReport.message ?? 'keep-all batch failed'}","messagePattern":"\\$\\{batchReport\\.message \\?\\? 'keep-all batch failed'\\}","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/keep-all-check.ts","lineNumber":151,"sourceCode":"    serverProcess = pageServer.process\n    const requestId = `${browser}-${Date.now()}-${Math.random().toString(36).slice(2)}`\n    const reportServer = await startPostedReportServer<ProbeBatchReport>(requestId)\n\n    try {\n      const url =\n        `${pageServer.baseUrl}/probe?batch=keep-all` +\n        `&requestId=${encodeURIComponent(requestId)}` +\n        `&reportEndpoint=${encodeURIComponent(reportServer.endpoint)}`\n      const batchReport = await loadPostedReport(\n        session,\n        url,\n        () => reportServer.waitForReport(null),\n        requestId,\n        reportBrowser,\n        timeoutMs,\n      )\n      if (batchReport.status === 'error') {\n        throw new Error(batchReport.message ?? 'keep-all batch failed')\n      }\n\n      const batchResults = batchReport.results ?? []\n      const reportsByLabel = new Map(batchResults.map(result => [result.label, result.report]))\n      for (const testCase of KEEP_ALL_ORACLE_CASES) {\n        if (!caseRunsInBrowser(testCase, browser)) continue\n        const report = reportsByLabel.get(testCase.label)\n        if (report === undefined) {\n          throw new Error(`Missing keep-all result for ${testCase.label}`)\n        }\n        printCaseResult(browser, testCase, report)\n        if (!reportIsExact(report)) ok = false\n      }\n    } finally {\n      reportServer.close()\n    }\n  } finally {\n    session?.close()","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/chenglou/pretext/blob/ac49b09b7d83ede19581fa94a8b892b07d309baf/scripts/keep-all-check.ts#L133-L169","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the wrapped batchReport.message printed in the error for the browser-side root cause.","Confirm the dev/probe page server is healthy and re-run; suspect stale tabs/servers before assuming an engine bug (per repo guidance).","Re-run with `--timeout=` raised if the message indicates a measurement timeout.","If the message points at a specific probe case, debug that case in isolation via the diagnostic /probe page."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"const isBatchError = (r: { status?: string }): boolean => r.status === 'error'","tryCatchPattern":"try {\n  await runBrowser(browser, port)\n} catch (e) {\n  const msg = e instanceof Error ? e.message : String(e)\n  if (msg.includes('keep-all batch failed') || msg.startsWith('keep-all')) {\n    console.error(`Probe batch error for ${browser}. Suspect stale tabs/servers first; see message: ${msg}`)\n    process.exit(1)\n  }\n  throw e\n}","preventionTips":["Ensure no other corpus/sweep/font-matrix job is running against the same browser (single-owner automation lock).","Suspect stale tabs/servers before assuming an engine bug, per repo guidance."],"tags":["browser-automation","probe","keep-all","diagnostics"],"backgroundTag":null,"analyzedSha":"ac49b09b7d83ede19581fa94a8b892b07d309baf","analyzedAt":"2026-08-12T17:03:16.263Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}