{"record":{"id":"523bab73a97fa6c1","repo":"unclecode/crawl4ai","slug":"memory-at-mem-pct-1f-refusing-new-browser","errorCode":null,"errorMessage":"Memory at {mem_pct:.1f}%, refusing new browser","messagePattern":"Memory at (.+?)%, refusing new browser","errorType":"exception","errorClass":"MemoryError","httpStatus":500,"severity":"error","filePath":"deploy/docker/crawler_pool.py","lineNumber":109,"sourceCode":"                HOT_POOL[sig] = COLD_POOL.pop(sig)\n\n                # Track promotion in monitor\n                try:\n                    from monitor import get_monitor\n                    await get_monitor().track_janitor_event(\"promote\", sig, {\"count\": USAGE_COUNT[sig]})\n                except:\n                    pass\n\n                return HOT_POOL[sig]\n\n            logger.info(f\"❄️  Using cold pool browser (sig={sig[:8]})\")\n            return crawler\n\n        # Memory check before creating new\n        mem_pct = get_container_memory_percent()\n        if mem_pct >= MEM_LIMIT:\n            logger.error(f\"💥 Memory pressure: {mem_pct:.1f}% >= {MEM_LIMIT}%\")\n            raise MemoryError(f\"Memory at {mem_pct:.1f}%, refusing new browser\")\n\n        # Create new in cold pool\n        logger.info(f\"🆕 Creating new browser in cold pool (sig={sig[:8]}, mem={mem_pct:.1f}%)\")\n        crawler = AsyncWebCrawler(config=cfg, thread_safe=False)\n        await crawler.start()\n        crawler.active_requests = 1\n        COLD_POOL[sig] = crawler\n        LAST_USED[sig] = time.time()\n        USAGE_COUNT[sig] = 1\n        return crawler\n\nasync def release_crawler(crawler: AsyncWebCrawler):\n    \"\"\"Decrement active request count for a pooled crawler.\n\n    Call this in a finally block after finishing work with a crawler\n    obtained via get_crawler() so the janitor knows when it's safe\n    to close idle browsers.\n    \"\"\"","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/unclecode/crawl4ai/blob/7e801521428ee12509994d39151006f64055ebe3/deploy/docker/crawler_pool.py#L91-L127","documentation":"Error \"Memory at {mem_pct:.1f}%, refusing new browser\" thrown in unclecode/crawl4ai.","triggerScenarios":"Thrown at deploy/docker/crawler_pool.py:109 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Wait for memory usage to drop or free memory on the host before requesting a new browser.","Lower the number of concurrent browsers or raise the memory threshold configuration if appropriate."],"exampleFix":"# Retry after existing crawl jobs complete and memory decreases","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7e801521428ee12509994d39151006f64055ebe3","analyzedAt":"2026-08-14T20:46:20.673Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}