{"record":{"id":"b115765ce3522729","repo":"zylon-ai/private-gpt","slug":"playwright-browsers-are-not-installed-run-playwr","errorCode":null,"errorMessage":"Playwright browsers are not installed. Run `playwright install` and try again.","messagePattern":"Playwright browsers are not installed\\. Run `playwright install` and try again\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"private_gpt/components/web/scraper/runner.py","lineNumber":133,"sourceCode":"\n    total_timeout = config.timeout_seconds * max(1, len(config.requests))\n    result = await session.exec(\n        f\"{session.python_executable} {shlex.quote(SCRIPT_FILENAME)}\"\n        f\" {shlex.quote(CONFIG_FILENAME)}\",\n        SandboxExecOptions(\n            cwd=base_dir, timeout=total_timeout + _EXEC_TIMEOUT_MARGIN_SECONDS\n        ),\n    )\n\n    if result.exit_code == 124:\n        raise TimeoutError(\n            f\"Timeout ({config.timeout_seconds}s) scraping \"\n            f\"{[r.url for r in config.requests]}\"\n        )\n    if result.failed:\n        error = result.stderr or result.stdout\n        if _BROWSERS_MISSING_PATTERN.search(error):\n            raise RuntimeError(\n                \"Playwright browsers are not installed. \"\n                \"Run `playwright install` and try again.\"\n            )\n        raise RuntimeError(\n            f\"Scrape script failed (exit_code={result.exit_code}): {error}\"\n        )\n\n    results_raw = json.loads(\n        (await session.read_file(posixpath.join(base_dir, RESULTS_FILENAME))).decode(\n            \"utf-8\"\n        )\n    )\n    by_output_path = {entry[\"output_path\"]: entry for entry in results_raw}\n\n    outputs: list[str | Exception] = []\n    for request in config.requests:\n        entry = by_output_path.get(request.output_path)\n        if entry is None:","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/zylon-ai/private-gpt/blob/4a030776a31a901ad80b1bf4d7faa2c1a367efbb/private_gpt/components/web/scraper/runner.py#L115-L151","documentation":"Raised when the scrape script run inside the sandbox session fails and its stderr/stdout matches _BROWSERS_MISSING_PATTERN — i.e. Playwright could not find an installed browser binary. The sandbox (local or opensandbox provider) runs the script with session.python_executable, so the browsers must be present in that execution environment, not just on the host.","triggerScenarios":"First run on a fresh machine/container where `playwright install` was never executed; using the opensandbox provider whose image lacks Chromium; PLAYWRIGHT_BROWSERS_PATH pointing to a location not visible inside the sandbox; upgrading Playwright without reinstalling the matching browser build.","commonSituations":"Fresh clone + uv sync without the browser step; slim Docker images that pip-install playwright but skip the browser download; CI caches that restore packages but not ~/.cache/ms-playwright; version mismatch after playwright package upgrade.","solutions":["Run `playwright install chromium` (or `playwright install`) in the same environment the sandbox uses.","If system dependencies are missing, also run `playwright install-deps chromium` (Linux).","For the opensandbox provider, bake `playwright install --with-deps` into the sandbox image or ensure PLAYWRIGHT_BROWSERS_PATH is mounted/valid inside it.","Pin the playwright version and reinstall browsers after every upgrade so binary revision matches the package."],"exampleFix":"# before: browsers absent, scrape raises RuntimeError\n# after (Dockerfile / setup)\nRUN uv sync --inexact --extra ingest-markup\nRUN uv run playwright install --with-deps chromium","handlingStrategy":"validation","validationCode":"import shutil\nfrom playwright.sync_api import sync_playwright\n\ndef browsers_available() -> bool:\n    try:\n        with sync_playwright() as p:\n            return p.chromium.executable_path is not None\n    except Exception:\n        return False\n\nassert browsers_available(), 'run: playwright install chromium'","typeGuard":"def is_browsers_missing_error(exc: BaseException) -> bool:\n    return isinstance(exc, RuntimeError) and 'Playwright browsers' in str(exc)","tryCatchPattern":"try:\n    outputs = await run_scrape_in_session(session, base_dir, config)\nexcept RuntimeError as e:\n    if 'Playwright browsers are not installed' in str(e):\n        subprocess.run([sys.executable, '-m', 'playwright', 'install', 'chromium'])\n        outputs = await run_scrape_in_session(session, base_dir, config)\n    raise","preventionTips":["Add `playwright install --with-deps chromium` to Dockerfile/CI setup steps.","Cache ~/.cache/ms-playwright in CI alongside the venv.","Reinstall browsers after every playwright package version bump."],"tags":["playwright","dependencies","sandbox","setup"],"backgroundTag":null,"analyzedSha":"4a030776a31a901ad80b1bf4d7faa2c1a367efbb","analyzedAt":"2026-08-15T03:51:26.951Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}