{"record":{"id":"6a76a3255fe32c17","repo":"chenglou/pretext","slug":"batchreport-message-letter-spacing-batch-fai","errorCode":null,"errorMessage":"${batchReport.message ?? 'letter-spacing batch failed'}","messagePattern":"\\$\\{batchReport\\.message \\?\\? 'letter-spacing batch failed'\\}","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/letter-spacing-check.ts","lineNumber":230,"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=letter-spacing` +\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 ?? 'letter-spacing 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 LETTER_SPACING_ORACLE_CASES) {\n        const report = reportsByLabel.get(testCase.label)\n        if (report === undefined) {\n          throw new Error(`Missing letter-spacing result for ${testCase.label}`)\n        }\n        printCaseResult(browser, testCase, report)\n        results.push(toOracleResult(browser, testCase, report))\n      }\n    } finally {\n      reportServer.close()\n    }\n  } finally {\n    session?.close()\n    serverProcess?.kill()","sourceCodeStart":212,"sourceCodeEnd":248,"githubUrl":"https://github.com/chenglou/pretext/blob/ac49b09b7d83ede19581fa94a8b892b07d309baf/scripts/letter-spacing-check.ts#L212-L248","documentation":"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.","triggerScenarios":"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.","commonSituations":"Transient automation flakiness, dev server not up, stale tabs/servers, or a real regression in the probe page.","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 points at a measurement timeout.","Reproduce the failing case in the diagnostic /probe page to localize."],"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('letter-spacing batch failed') || /letter-spacing/i.test(msg)) {\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":["Don't run multiple automation jobs against the same browser concurrently (single-owner lock).","Suspect stale tabs/servers first; raise --timeout before assuming an engine regression."],"tags":["browser-automation","probe","letter-spacing","diagnostics"],"backgroundTag":null,"analyzedSha":"ac49b09b7d83ede19581fa94a8b892b07d309baf","analyzedAt":"2026-08-12T17:03:16.263Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}