{"record":{"id":"6007cba835e6ebd7","repo":"NanmiCoder/MediaCrawler","slug":"http-response-status-code-response-text","errorCode":null,"errorMessage":"HTTP {response.status_code}: {response.text}","messagePattern":"HTTP (.+?): (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"tools/cdp_browser.py","lineNumber":308,"sourceCode":"        Get browser WebSocket connection URL\n        \"\"\"\n        try:\n            async with httpx.AsyncClient() as client:\n                response = await client.get(\n                    f\"http://localhost:{debug_port}/json/version\", timeout=10\n                )\n                if response.status_code == 200:\n                    data = response.json()\n                    ws_url = data.get(\"webSocketDebuggerUrl\")\n                    if ws_url:\n                        utils.logger.info(\n                            f\"[CDPBrowserManager] Got browser WebSocket URL: {ws_url}\"\n                        )\n                        return ws_url\n                    else:\n                        raise RuntimeError(\"webSocketDebuggerUrl not found\")\n                else:\n                    raise RuntimeError(f\"HTTP {response.status_code}: {response.text}\")\n        except Exception as e:\n            utils.logger.error(f\"[CDPBrowserManager] Failed to get WebSocket URL: {e}\")\n            raise\n\n    async def _connect_via_cdp(self, playwright: Playwright):\n        \"\"\"\n        Connect to browser via CDP\n        \"\"\"\n        try:\n            if config.CDP_CONNECT_EXISTING:\n                # Existing browser remote debugging in Chrome 136+ does not expose\n                # /json/version. Connect directly and wait for user confirmation.\n                ws_url = f\"ws://localhost:{self.debug_port}/devtools/browser\"\n                utils.logger.info(f\"[CDPBrowserManager] Connecting to existing browser via CDP: {ws_url}\")\n                utils.logger.info(\n                    \"[CDPBrowserManager] Please check your browser for a confirmation dialog and accept it\"\n                )\n                try:","sourceCodeStart":290,"sourceCodeEnd":326,"githubUrl":"https://github.com/NanmiCoder/MediaCrawler/blob/d6f7c5bb906b6dac40ddf343ef9e26438a3de092/tools/cdp_browser.py#L290-L326","documentation":"Error \"HTTP {response.status_code}: {response.text}\" thrown in NanmiCoder/MediaCrawler.","triggerScenarios":"Thrown at tools/cdp_browser.py:308 when the library encounters an invalid state.","commonSituations":"The GET to /json/version on the browser debug port returned a non-200 status. Typical causes: browser not running, remote debugging not enabled (--remote-debugging-port missing), wrong CDP_DEBUG_PORT, or a firewall/proxy intercepting localhost. Defensive fix: check that the browser process is alive and the port is listening before requesting, and include the port and status in the error so users can verify with curl http://localhost:<port>/json/version.","solutions":["Check the HTTP status code in the message: a non-200 from /json/version means the browser debug endpoint is unreachable or rejected the request.","Confirm the browser is running and was started with --remote-debugging-port matching config.CDP_DEBUG_PORT.","Test the endpoint directly: curl http://localhost:<CDP_DEBUG_PORT>/json/version to see the raw response.","Ensure no proxy or security software is intercepting localhost HTTP requests, and retry after restarting the browser."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"d6f7c5bb906b6dac40ddf343ef9e26438a3de092","analyzedAt":"2026-08-15T01:39:07.505Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}