{"record":{"id":"98eb5d381d6f38ea","repo":"pbakaus/impeccable","slug":"chromium-unavailable-err-message-err","errorCode":null,"errorMessage":"Chromium unavailable: ${err?.message || err}","messagePattern":"Chromium unavailable: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/benchmark-detector.mjs","lineNumber":399,"sourceCode":"      mode: 'pure-vs-overlay',\n      target: serverInfo.baseUrl,\n      run: async (profile) => {\n        let browser;\n        const launchStarted = nowMs();\n        try {\n          browser = await puppeteer.default.launch({\n            headless: true,\n            args: process.env.CI ? ['--no-sandbox', '--disable-setuid-sandbox'] : [],\n          });\n          addEvent(profile, {\n            engine: 'browser',\n            phase: 'load',\n            ruleId: 'launch-browser-overlay-bench',\n            target: serverInfo.baseUrl,\n            ms: nowMs() - launchStarted,\n          });\n        } catch (err) {\n          throw new Error(`Chromium unavailable: ${err?.message || err}`);\n        }\n\n        let findings = [];\n        try {\n          const page = await browser.newPage();\n          const url = `${serverInfo.baseUrl}/fixtures/antipatterns/${browserFiles[0]}`;\n          const browserScript = fs.readFileSync(path.join(ROOT, 'cli', 'engine', 'detect-antipatterns-browser.js'), 'utf-8');\n          await page.setViewport({ width: 1280, height: 800 });\n          await page.goto(url, { waitUntil: 'load', timeout: 30000 });\n          await new Promise(resolve => setTimeout(resolve, 100));\n          await page.evaluate(() => { window.__IMPECCABLE_CONFIG__ = { autoScan: false }; });\n          await page.evaluate(browserScript);\n          const pureStarted = nowMs();\n          findings = await page.evaluate(() => {\n            const serialized = window.impeccableDetect({ decorate: false, serialize: true });\n            return serialized.flatMap(({ findings }) => findings.map(f => ({ id: f.type, snippet: f.detail })));\n          });\n          addEvent(profile, {","sourceCodeStart":381,"sourceCodeEnd":417,"githubUrl":"https://github.com/pbakaus/impeccable/blob/d14711ae3d1a1dd62dee61a358d27f107c51ccd0/scripts/benchmark-detector.mjs#L381-L417","documentation":"Thrown by the benchmark-detector browser run when puppeteer.launch fails to start a headless Chromium. The underlying launch error is appended so the caller can tell whether Chromium is missing, lacks permissions, or hit a sandbox issue.","triggerScenarios":"Running the browser-engine benchmark when Chromium is not installed, cannot run headless in the current environment, or fails to launch within puppeteer.","commonSituations":"Fresh CI without `npx puppeteer install chromium`, a sandbox that blocks Chrome launch, or a broken puppeteer cache.","solutions":["Install the browser cache: `npx puppeteer install chromium` (or `puppeteer browsers install chrome`).","In CI, ensure the launch args include --no-sandbox (the script already does this when process.env.CI is set).","Verify system dependencies for Chromium are present (libnss3, libatk, etc.) and the cache path is writable."],"exampleFix":"# before: Chromium not installed\nnode scripts/benchmark-detector.mjs --engine browser\n\n# after\nnpx puppeteer install chromium\nnode scripts/benchmark-detector.mjs --engine browser","handlingStrategy":"try-catch","validationCode":"import { existsSync } from 'node:fs';\nimport puppeteer from 'puppeteer';\nasync function chromiumAvailable() {\n  try {\n    const b = await puppeteer.default.launch({ headless: true });\n    await b.close();\n    return true;\n  } catch { return false; }\n}","typeGuard":"async function canLaunchChromium() {\n  try {\n    const b = await puppeteer.default.launch({ headless: 'new' });\n    await b.close();\n    return true;\n  } catch { return false; }\n}","tryCatchPattern":"try {\n  browser = await puppeteer.default.launch({ headless: true });\n} catch (err) {\n  console.warn(`Chromium unavailable: ${err.message}; skipping browser engine`);\n  return; // skip the browser run instead of aborting the whole benchmark\n}","preventionTips":["Run `npx puppeteer install chromium` as part of environment setup.","Gate the browser-engine benchmark behind a capability check and skip cleanly if absent.","Pin a working puppeteer/Chromium combination in CI."],"tags":["benchmark","puppeteer","chromium","environment","ci"],"backgroundTag":null,"analyzedSha":"d14711ae3d1a1dd62dee61a358d27f107c51ccd0","analyzedAt":"2026-08-13T00:52:25.771Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}