{"record":{"id":"9ba2ca48705f5729","repo":"NanmiCoder/MediaCrawler","slug":"no-available-browser-found-please-ensure-chrome-o","errorCode":null,"errorMessage":"No available browser found. Please ensure Chrome or Edge browser is installed, or set CUSTOM_BROWSER_PATH in config file to specify browser path.","messagePattern":"No available browser found\\. Please ensure Chrome or Edge browser is installed, or set CUSTOM_BROWSER_PATH in config file to specify browser path\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"critical","filePath":"tools/cdp_browser.py","lineNumber":212,"sourceCode":"        utils.logger.info(\"[CDPBrowserManager] Successfully connected to existing browser\")\n        return browser_context\n\n    async def _get_browser_path(self) -> str:\n        \"\"\"\n        Get browser path\n        \"\"\"\n        # Prefer user-defined path\n        if config.CUSTOM_BROWSER_PATH and os.path.isfile(config.CUSTOM_BROWSER_PATH):\n            utils.logger.info(\n                f\"[CDPBrowserManager] Using custom browser path: {config.CUSTOM_BROWSER_PATH}\"\n            )\n            return config.CUSTOM_BROWSER_PATH\n\n        # Auto-detect browser path\n        browser_paths = self.launcher.detect_browser_paths()\n\n        if not browser_paths:\n            raise RuntimeError(\n                \"No available browser found. Please ensure Chrome or Edge browser is installed, \"\n                \"or set CUSTOM_BROWSER_PATH in config file to specify browser path.\"\n            )\n\n        browser_path = browser_paths[0]  # Use the first browser found\n        browser_name, browser_version = self.launcher.get_browser_info(browser_path)\n\n        utils.logger.info(\n            f\"[CDPBrowserManager] Detected browser: {browser_name} ({browser_version})\"\n        )\n        utils.logger.info(f\"[CDPBrowserManager] Browser path: {browser_path}\")\n\n        return browser_path\n\n    async def _test_cdp_connection(self, debug_port: int) -> bool:\n        \"\"\"\n        Test if CDP connection is available\n        \"\"\"","sourceCodeStart":194,"sourceCodeEnd":230,"githubUrl":"https://github.com/NanmiCoder/MediaCrawler/blob/d6f7c5bb906b6dac40ddf343ef9e26438a3de092/tools/cdp_browser.py#L194-L230","documentation":"Raised by CDPBrowserManager._get_browser_path() when no Chrome/Edge executable is found: config.CUSTOM_BROWSER_PATH is unset or does not exist as a file, and launcher.detect_browser_paths() returns an empty list for all known install locations. The crawler cannot launch a browser to drive.","triggerScenarios":"Running on a machine with no Chrome/Edge installed (typical minimal Docker/alpine images, CI runners, headless servers); CUSTOM_BROWSER_PATH pointing to a wrong or non-existent path; Chromium installed under an unrecognized name/location so detection misses it.","commonSituations":"Docker deployments that never install a browser; macOS/Windows paths changed by channel (Chrome Beta/Canary only); CUSTOM_BROWSER_PATH set to a directory instead of the binary; Playwright-bundled chromium present but not detected because only Chrome/Edge paths are scanned.","solutions":["Install Google Chrome or Microsoft Edge on the host","Or set CUSTOM_BROWSER_PATH in config to the exact binary path (verify with `which google-chrome` / `ls`)","In Docker, install chromium and point CUSTOM_BROWSER_PATH at it (e.g. /usr/bin/chromium)","os.path.isfile is strict: ensure the path is the executable file itself, not its directory, and is readable"],"exampleFix":"# before\nCUSTOM_BROWSER_PATH = \"\"  # and no system Chrome installed\n\n# after (Docker example)\napt-get install -y chromium\n# config/base_config.py\nCUSTOM_BROWSER_PATH = \"/usr/bin/chromium\"","handlingStrategy":"validation","validationCode":"import os, shutil\n\ndef browser_binary_available() -> bool:\n    if config.CUSTOM_BROWSER_PATH:\n        return os.path.isfile(config.CUSTOM_BROWSER_PATH)\n    return bool(shutil.which(\"google-chrome\") or shutil.which(\"chromium\") or shutil.which(\"microsoft-edge\"))\n\nif not browser_binary_available():\n    raise SystemExit(\"install Chrome/Edge or set CUSTOM_BROWSER_PATH to the binary\")","typeGuard":"def has_browser_path() -> bool:\n    custom = getattr(config, \"CUSTOM_BROWSER_PATH\", \"\")\n    return (bool(custom) and os.path.isfile(custom)) or bool(shutil.which(\"google-chrome\")) or bool(shutil.which(\"chromium\"))","tryCatchPattern":"try:\n    path = await mgr._get_browser_path()\nexcept RuntimeError as e:\n    raise SystemExit(\n        f\"{e}\\nFix: apt-get install -y chromium (or install Chrome) \"\n        \"then set CUSTOM_BROWSER_PATH=/usr/bin/chromium\"\n    ) from e","preventionTips":["Bake Chrome/Chromium into Docker images used for crawling","Set CUSTOM_BROWSER_PATH to the binary file (verify with `which`), not a directory","Add an environment preflight that checks for a browser before a long crawl"],"tags":["browser","chrome","environment","docker","configuration"],"backgroundTag":null,"analyzedSha":"d6f7c5bb906b6dac40ddf343ef9e26438a3de092","analyzedAt":"2026-08-15T01:39:07.505Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}