{"record":{"id":"8fc3a35c26d884f0","repo":"unclecode/crawl4ai","slug":"cls-name-must-implement-run-self-url-str","errorCode":null,"errorMessage":"{cls.__name__} must implement 'run(self, url: str, **kwargs)'","messagePattern":"(.+?) must implement 'run\\(self, url: str, \\*\\*kwargs\\)'","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"crawl4ai/hub.py","lineNumber":31,"sourceCode":"    def __init__(self):\n        self.logger = logging.getLogger(self.__class__.__name__)\n        \n    @abstractmethod\n    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                    )","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/unclecode/crawl4ai/blob/7e801521428ee12509994d39151006f64055ebe3/crawl4ai/hub.py#L13-L49","documentation":"Error \"{cls.__name__} must implement 'run(self, url: str, **kwargs)'\" thrown in unclecode/crawl4ai.","triggerScenarios":"Thrown at crawl4ai/hub.py:31 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Implement a run(self, url: str, **kwargs) method on the strategy class.","Subclass BaseStrategy from crawl4ai.hub and implement the required run method."],"exampleFix":"class MyStrategy(BaseStrategy):\n    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-15T17:31:12.345Z"}