{"record":{"id":"ef20e32ea9a108b4","repo":"srbhr/Resume-Matcher","slug":"playwright-browser-executable-is-missing-or-out-of","errorCode":null,"errorMessage":"Playwright browser executable is missing or out of date. Command shown for reference; quote the path if it contains spaces: {command}","messagePattern":"Playwright browser executable is missing or out of date\\. Command shown for reference; quote the path if it contains spaces: (.+?)","errorType":"exception","errorClass":"PDFRenderError","httpStatus":null,"severity":"error","filePath":"apps/backend/app/pdf.py","lineNumber":234,"sourceCode":"\n\nasync def _render_resume_pdf_in_thread(\n    url: str,\n    selector: str,\n    pdf_format: str,\n    pdf_margins: dict,\n) -> bytes:\n    return await asyncio.to_thread(\n        _render_resume_pdf_sync, url, selector, pdf_format, pdf_margins\n    )\n\n\ndef _raise_playwright_error(error: PlaywrightError, url: str) -> NoReturn:\n    error_msg = str(error)\n    if \"Executable doesn't exist\" in error_msg:\n        exe = sys.executable.replace(\"\\\\\", \"/\")\n        command = f\"{exe} -m playwright install chromium\"\n        raise PDFRenderError(\n            \"Playwright browser executable is missing or out of date. \"\n            \"Command shown for reference; quote the path if it contains spaces: \"\n            f\"{command}\"\n        ) from error\n    if \"net::ERR_CONNECTION_REFUSED\" in error_msg:\n        raise PDFRenderError(\n            f\"Cannot connect to frontend for PDF generation. \"\n            f\"Attempted URL: {url}. \"\n            f\"Please ensure: 1) The frontend is running, \"\n            f\"2) The FRONTEND_BASE_URL environment variable in the backend .env file \"\n            f\"matches the URL where your frontend is accessible.\"\n        ) from error\n    # Catch-all: the raw Playwright message can carry internal navigation URLs\n    # and a full call log. Log it server-side; return a generic message to the\n    # client (CLAUDE.md rule 5 — and it stops the verbose trace from overflowing\n    # the client error modal, #811).\n    logger.error(\"PDF rendering failed for %s: %s\", url, error_msg)\n    raise PDFRenderError(","sourceCodeStart":216,"sourceCodeEnd":252,"githubUrl":"https://github.com/srbhr/Resume-Matcher/blob/116f9cc3b00e1ac91734a6c2679bf41ea64a0edc/apps/backend/app/pdf.py#L216-L252","documentation":"PDFRenderError raised by _raise_playwright_error when Playwright reports \"Executable doesn't exist\". The installed playwright package cannot find a matching Chromium build, usually because `playwright install` was never run after installing or upgrading the package. The message embeds the exact install command (with sys.executable path) for the operator.","triggerScenarios":"render_resume_pdf calls Playwright to launch chromium and the driver raises PlaywrightError containing \"Executable doesn't exist\" — i.e. no browser binary downloaded for the current playwright version (fresh install, version upgrade, CI cache miss, different Python venv).","commonSituations":"Fresh clone without running the browser install step; pip/uv upgraded playwright to a version expecting a new Chromium revision; CI pipeline restored a virtualenv but not ~/.cache/ms-playwright; running under a different interpreter (sys.executable) than the one where browsers were installed; Docker image built without the install layer.","solutions":["Run the printed command: `<python> -m playwright install chromium`","If the path contains spaces, quote it as the message says, or run `<python> -m playwright install` with the interpreter from sys.executable","In CI/Docker, add a cached Playwright browser install step pinned to the playwright version in requirements","Verify you are using the same virtualenv/interpreter that installed the browsers","Pin playwright version so upgrades don't silently require a new browser revision"],"exampleFix":"// before\npip install playwright\nuvicorn app.main:app  # PDF generation fails: executable missing\n// after\npip install playwright\npython -m playwright install chromium\nuvicorn app.main:app","handlingStrategy":"try-catch","validationCode":"import shutil, subprocess, sys\nfrom playwright._impl._driver import compute_driver_executable\ndef chromium_ready() -> bool:\n    try:\n        out = subprocess.run([sys.executable, \"-m\", \"playwright\", \"install\", \"--dry-run\", \"chromium\"], capture_output=True)\n        return out.returncode == 0\n    except Exception:\n        return False","typeGuard":"def is_missing_executable(err: Exception) -> bool:\n    return isinstance(err, Exception) and \"Executable doesn't exist\" in str(err)","tryCatchPattern":"try:\n    pdf = await render_resume_pdf(url, selector)\nexcept PDFRenderError as e:\n    if \"playwright install\" in str(e):\n        subprocess.run([sys.executable, \"-m\", \"playwright\", \"install\", \"chromium\"], check=True)\n        pdf = await render_resume_pdf(url, selector)\n    else:\n        raise","preventionTips":["Always run `python -m playwright install chromium` after installing/upgrading playwright","Pin the playwright version so browser revisions don't shift unexpectedly","Cache ~/.cache/ms-playwright (or PLAYWRIGHT_BROWSERS_PATH) in CI","Bake browser install into the Docker image build","Use one virtualenv per project and install browsers with that same interpreter"],"tags":["pdf","playwright","chromium","setup","python"],"backgroundTag":"playwright-browser-not-installed","analyzedSha":"116f9cc3b00e1ac91734a6c2679bf41ea64a0edc","analyzedAt":"2026-08-28T22:51:40.999Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}