{"record":{"id":"924a1d290ca9c46a","repo":"xtekky/gpt4free","slug":"google-chrome-chromium-edge-executable-not-fou","errorCode":null,"errorMessage":"Google Chrome / Chromium / Edge executable not found.","messagePattern":"Google Chrome / Chromium / Edge executable not found\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"critical","filePath":"g4f/requests/cdp.py","lineNumber":226,"sourceCode":"                # Browser died or became unreachable, clean up\n                if _shared_browser_process:\n                    try:\n                        _shared_browser_process.terminate()\n                    except Exception:\n                        pass\n                    _shared_browser_process = None\n                _shared_browser_port = None\n\n        # 2. Check if a browser is already running anywhere on the system with CDP remote debugging\n        running_port = find_running_cdp_port(host)\n        if running_port is not None:\n            _shared_browser_port = running_port\n            return _shared_browser_port\n\n        # 3. Otherwise, launch a new shared Chromium process on a free port\n        chrome_path = find_chrome_path()\n        if not chrome_path:\n            raise RuntimeError(\"Google Chrome / Chromium / Edge executable not found.\")\n\n        # Find a free port dynamically\n        import socket\n\n        with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:\n            s.bind((\"\", 0))\n            port = s.getsockname()[1]\n\n        # Use standard user config directory for profile caching (like other g4f browsers)\n        try:\n            from platformdirs import user_config_dir\n\n            user_data_dir = user_config_dir(\"g4f-cdp\")\n        except ImportError:\n            import tempfile\n\n            user_data_dir = os.path.join(\n                tempfile.gettempdir(), \"g4f_chrome_profile_cdp\"","sourceCodeStart":208,"sourceCodeEnd":244,"githubUrl":"https://github.com/xtekky/gpt4free/blob/973504e1770928ed5fb82f43da528f441ad9ddc3/g4f/requests/cdp.py#L208-L244","documentation":"Raised in g4f/requests/cdp.py's shared-browser bootstrap (get_shared_browser_port flow) when no already-running CDP endpoint was found on the host and find_chrome_path() could not locate a Chrome, Chromium, or Edge binary in standard locations. The CDP client never launches its own bundled browser — it relies on a system-installed Chromium-family executable, so none found means automation cannot start.","triggerScenarios":"First use of CDPSession/SyncCDPSession on a machine (or container) with no Chrome/Chromium/Edge installed or installed in a non-standard path; headless servers and slim Docker images where no browser was ever added.","commonSituations":"Deploying to alpine/slim Docker images; macOS with Chrome only in a user profile that find_chrome_path does not scan; Linux servers where only firefox is present.","solutions":["Install Google Chrome, Chromium, or Microsoft Edge on the host (e.g. apt-get install -y chromium on Debian/Ubuntu).","If the browser is installed in a non-standard location, point g4f at it via its browser executable configuration (BrowserConfig/executable path settings) instead of relying on auto-detection.","In Docker, add a browser layer, e.g. `FROM chromedp/headless-shell` style images or install chromium in the Dockerfile.","Verify detection before running: check that `chromium --version` (or equivalent) works from the same environment."],"exampleFix":"# Dockerfile before: FROM python:3.12-slim (no browser)\n# after\nFROM python:3.12-slim\nRUN apt-get update && apt-get install -y chromium && rm -rf /var/lib/apt/lists/*","handlingStrategy":"validation","validationCode":"import shutil\n\ndef has_chromium() -> bool:\n    return any(shutil.which(b) for b in (\"google-chrome\", \"google-chrome-stable\", \"chromium\", \"chromium-browser\", \"microsoft-edge\"))","typeGuard":null,"tryCatchPattern":"try:\n    port = get_shared_browser_port()  # or CDPSession()/start()\nexcept RuntimeError as e:\n    if \"executable not found\" in str(e):\n        raise SystemExit(\"Install Chrome/Chromium/Edge first\")\n    raise","preventionTips":["Bake a Chromium-family browser into deployment images (Dockerfile apt-get install chromium).","Run a startup smoke check that a chrome/chromium binary resolves on PATH.","If installed in a custom path, configure g4f's browser executable path explicitly."],"tags":["cdp","browser-not-found","environment","chrome","deployment"],"backgroundTag":null,"analyzedSha":"973504e1770928ed5fb82f43da528f441ad9ddc3","analyzedAt":"2026-08-14T23:45:32.408Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}