{"record":{"id":"32850911db420b00","repo":"unclecode/crawl4ai","slug":"request-timed-out-str-e-328509","errorCode":null,"errorMessage":"Request timed out: {str(e)}","messagePattern":"Request timed out: (.+?)","errorType":"exception","errorClass":"ConnectionError","httpStatus":null,"severity":"error","filePath":"crawl4ai/docker_client.py","lineNumber":117,"sourceCode":"                # Already in string format\n                hooks_code = hooks\n\n            request_data[\"hooks\"] = {\n                \"code\": hooks_code,\n                \"timeout\": hooks_timeout\n            }\n\n        return request_data\n\n    async def _request(self, method: str, endpoint: str, **kwargs) -> httpx.Response:\n        \"\"\"Make an HTTP request with error handling.\"\"\"\n        url = urljoin(self.base_url, endpoint)\n        try:\n            response = await self._http_client.request(method, url, **kwargs)\n            response.raise_for_status()\n            return response\n        except httpx.TimeoutException as e:\n            raise ConnectionError(f\"Request timed out: {str(e)}\")\n        except httpx.RequestError as e:\n            raise ConnectionError(f\"Failed to connect: {str(e)}\")\n        except httpx.HTTPStatusError as e:\n            error_msg = (e.response.json().get(\"detail\", str(e)) \n                        if \"application/json\" in e.response.headers.get(\"content-type\", \"\") \n                        else str(e))\n            raise RequestError(f\"Server error {e.response.status_code}: {error_msg}\")\n\n    async def crawl(\n        self,\n        urls: List[str],\n        browser_config: Optional[BrowserConfig] = None,\n        crawler_config: Optional[CrawlerRunConfig] = None,\n        hooks: Optional[Union[Dict[str, Callable], Dict[str, str]]] = None,\n        hooks_timeout: int = 30\n    ) -> Union[CrawlResult, List[CrawlResult], AsyncGenerator[CrawlResult, None]]:\n        \"\"\"\n        Execute a crawl operation.","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/unclecode/crawl4ai/blob/7e801521428ee12509994d39151006f64055ebe3/crawl4ai/docker_client.py#L99-L135","documentation":"Raised by Crawl4aiDockerClient._request when the httpx call to the server raises httpx.TimeoutException — the request exceeded the configured timeout before completing. It is converted to ConnectionError('Request timed out: ...') with the underlying httpx timeout detail.","triggerScenarios":"Any client API call (crawl, get_schema, etc.) where the server takes longer than the effective httpx timeout — note crawl() passes hooks_timeout (default 30s) as the request timeout; long crawls with on-hook execution can exceed it.","commonSituations":"Crawling slow or large sites through the Docker server with the default 30-second timeout; server under heavy load; hooks_timeout left at default while browser hooks (login, waits) take minutes; running many concurrent crawl batches that queue on the server.","solutions":["Raise the timeout for slow operations: pass a larger hooks_timeout to crawl(...)","Construct the client with a larger default httpx timeout if the base client exposes it","Reduce crawl size (fewer URLs per call) or split into batches so each request finishes faster","Check server load/logs — a systematically slow server needs resources, not just bigger timeouts"],"exampleFix":"// before\nresults = await client.crawl(urls, browser_config=b, crawler_config=c)  # 30s default\n\n// after\nresults = await client.crawl(urls, browser_config=b, crawler_config=c, hooks_timeout=300)","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"import asyncio\n\nasync def crawl_with_retry(client, **kw):\n    for i in range(3):\n        try:\n            return await client.crawl(**kw)\n        except ConnectionError as e:\n            if \"timed out\" not in str(e) or i == 2:\n                raise\n            await asyncio.sleep(2 ** i)\n            kw[\"hooks_timeout\"] = kw.get(\"hooks_timeout\", 30) * 2","preventionTips":["Set hooks_timeout proportional to expected crawl duration (e.g. 300s for big sites)","Batch URLs so each request finishes within the timeout","Monitor server load — growing timeouts signal resource starvation"],"tags":["docker-client","timeout","network"],"backgroundTag":null,"analyzedSha":"7e801521428ee12509994d39151006f64055ebe3","analyzedAt":"2026-08-14T20:46:20.673Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}