{"record":{"id":"844f37e4b71a45f8","repo":"srbhr/Resume-Matcher","slug":"playwright-browser-executable-is-missing-and-no-s","errorCode":null,"errorMessage":"Playwright browser executable is missing, and no system Chrome/Edge installation was found. Install Playwright browsers or install Chrome/Edge.","messagePattern":"Playwright browser executable is missing, and no system Chrome/Edge installation was found\\. Install Playwright browsers or install Chrome/Edge\\.","errorType":"exception","errorClass":"PDFRenderError","httpStatus":null,"severity":"critical","filePath":"apps/backend/app/pdf.py","lineNumber":131,"sourceCode":"            Path(os.path.expanduser(\"~/.local/share/flatpak/exports/bin/com.google.Chrome\")),\n            Path(os.path.expanduser(\"~/.local/share/flatpak/exports/bin/org.chromium.Chromium\")),\n        ]\n\n    for candidate in candidates:\n        if candidate.exists():\n            return str(candidate)\n    return None\n\n\nasync def _launch_browser(playwright: Playwright) -> Browser:\n    try:\n        return await playwright.chromium.launch()\n    except PlaywrightError as e:\n        if \"Executable doesn't exist\" not in str(e):\n            raise\n        fallback_executable = _find_chromium_executable()\n        if not fallback_executable:\n            raise PDFRenderError(\n                \"Playwright browser executable is missing, and no system Chrome/Edge \"\n                \"installation was found. Install Playwright browsers or install Chrome/Edge.\"\n            ) from e\n        return await playwright.chromium.launch(executable_path=fallback_executable)\n\n\nasync def _render_page_to_pdf(\n    page: Page,\n    url: str,\n    selector: str,\n    pdf_format: str,\n    pdf_margins: dict,\n) -> bytes:\n    # NOTE: do NOT use wait_until=\"networkidle\" here. The Next.js dev server\n    # (HMR/Turbopack + RSC streaming) keeps the network busy, so \"idle\" may\n    # never arrive and goto silently hangs until timeout → 503 (issues\n    # #799/#808), with the failure depending on environment/network noise.\n    # Wait on the real readiness condition instead — document \"load\", the","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/srbhr/Resume-Matcher/blob/116f9cc3b00e1ac91734a6c2679bf41ea64a0edc/apps/backend/app/pdf.py#L113-L149","documentation":"_launch_browser first tries playwright.chromium.launch(); if Playwright raises an 'Executable doesn't exist' error (browsers not installed), it looks for a system Chrome/Edge via _find_chromium_executable(). When neither exists it raises PDFRenderError with this message.","triggerScenarios":"PDF rendering requested (init_pdf_renderer or _run) while the Playwright Chromium bundle was never downloaded and no system chrome/chromium/msedge binary is on PATH or in standard install locations.","commonSituations":"Fresh deploy/Docker image that ran `pip install playwright` but skipped `playwright install chromium`; slim container images without system Chrome; CI runners without browser caching.","solutions":["Run `playwright install chromium` (add `--with-deps` on Debian/Ubuntu for system libraries)","Or install system Chrome/Edge so _find_chromium_executable() finds a fallback executable","In Docker, add a build step: `RUN playwright install --with-deps chromium`","Cache the Playwright browser directory in CI to avoid reinstalling each run"],"exampleFix":"// Dockerfile before\nRUN pip install playwright\n// after\nRUN pip install playwright && playwright install --with-deps chromium","handlingStrategy":"fallback","validationCode":"import shutil\nfrom playwright.sync_api import sync_playwright\n\ndef browser_available() -> bool:\n    try:\n        with sync_playwright() as p:\n            p.chromium.launch().close()\n        return True\n    except Exception:\n        return bool(shutil.which(\"chrome\") or shutil.which(\"chromium\") or shutil.which(\"msedge\"))","typeGuard":null,"tryCatchPattern":"try:\n    pdf = await render_resume_pdf(resume_id)\nexcept PDFRenderError as e:\n    if 'executable is missing' in str(e):\n        log.critical(\"Playwright browsers not installed; run `playwright install chromium`\")\n        return HTMLFallbackResponse(resume_id)  # degrade to printable HTML\n    raise","preventionTips":["Always run `playwright install --with-deps chromium` in Dockerfiles and setup scripts","Cache the Playwright browsers path (~/.cache/ms-playwright) in CI","Add a startup check in init_pdf_renderer that fails fast with install instructions","Pin Playwright versions so the browser bundle matches the library version"],"tags":["playwright","pdf","missing-browser","backend","deployment"],"backgroundTag":"browser-executable-not-found","analyzedSha":"116f9cc3b00e1ac91734a6c2679bf41ea64a0edc","analyzedAt":"2026-08-28T22:51:40.999Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}