{"record":{"id":"6cdb14ab5b5ae1e3","repo":"unclecode/crawl4ai","slug":"cls-name-run-must-be-async","errorCode":null,"errorMessage":"{cls.__name__}.run must be async","messagePattern":"(.+?)\\.run must be async","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"crawl4ai/hub.py","lineNumber":35,"sourceCode":"    async def run(self, url: str = \"\", **kwargs) -> str:\n        \"\"\"\n        Implement this method to return JSON string.\n        Must accept URL + arbitrary kwargs for flexibility.\n        \"\"\"\n        pass\n\n    def __init_subclass__(cls, **kwargs):\n        \"\"\"Enforce interface validation on subclassing\"\"\"\n        super().__init_subclass__(**kwargs)\n        \n        # Verify run method signature\n        run_method = cls.run\n        if not run_method.__code__.co_argcount >= 2:  # self + url\n            raise TypeError(f\"{cls.__name__} must implement 'run(self, url: str, **kwargs)'\")\n            \n        # Verify async nature\n        if not inspect.iscoroutinefunction(run_method):\n            raise TypeError(f\"{cls.__name__}.run must be async\")\n\nclass CrawlerHub:\n    _crawlers: Dict[str, Type[BaseCrawler]] = {}\n\n    @classmethod\n    def _discover_crawlers(cls):\n        \"\"\"Dynamically load crawlers from /crawlers in 3 lines\"\"\"\n        base_path = Path(__file__).parent / \"crawlers\"\n        for crawler_dir in base_path.iterdir():\n            if crawler_dir.is_dir():\n                try:\n                    module = importlib.import_module(\n                        f\"crawl4ai.crawlers.{crawler_dir.name}.crawler\"\n                    )\n                    for attr in dir(module):\n                        cls._maybe_register_crawler(\n                            getattr(module, attr), crawler_dir.name\n                        )","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/unclecode/crawl4ai/blob/7e801521428ee12509994d39151006f64055ebe3/crawl4ai/hub.py#L17-L53","documentation":"Error \"{cls.__name__}.run must be async\" thrown in unclecode/crawl4ai.","triggerScenarios":"Thrown at crawl4ai/hub.py:35 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Declare the run method with async def so it can be awaited by the hub.","Remove blocking synchronous calls from run or wrap them with asyncio.to_thread."],"exampleFix":"async def run(self, url: str, **kwargs): ...","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"}