{"record":{"id":"41854470a64589f7","repo":"unclecode/crawl4ai","slug":"getting-name-is-deprecated-self-unwanted-pr","errorCode":null,"errorMessage":"Getting '{name}' is deprecated. {self._UNWANTED_PROPS[name]}","messagePattern":"Getting '(.+?)' is deprecated\\. (.+?)","errorType":"exception","errorClass":"AttributeError","httpStatus":null,"severity":"warning","filePath":"crawl4ai/async_configs.py","lineNumber":2045,"sourceCode":"                    from fnmatch import fnmatch\n                    results.append(fnmatch(url, matcher))\n                else:\n                    # Skip invalid matchers\n                    continue\n            \n            # Apply match mode logic\n            if self.match_mode == MatchMode.OR:\n                return any(results) if results else False\n            else:  # AND mode\n                return all(results) if results else False\n        \n        return False\n\n\n    def __getattr__(self, name):\n        \"\"\"Handle attribute access.\"\"\"\n        if name in self._UNWANTED_PROPS:\n            raise AttributeError(f\"Getting '{name}' is deprecated. {self._UNWANTED_PROPS[name]}\")\n        raise AttributeError(f\"'{self.__class__.__name__}' has no attribute '{name}'\")\n\n    def __setattr__(self, name, value):\n        \"\"\"Handle attribute setting.\"\"\"\n        # TODO: Planning to set properties dynamically based on the __init__ signature\n        sig = inspect.signature(self.__init__)\n        all_params = sig.parameters  # Dictionary of parameter names and their details\n\n        if name in self._UNWANTED_PROPS and value is not all_params[name].default:\n            raise AttributeError(f\"Setting '{name}' is deprecated. {self._UNWANTED_PROPS[name]}\")\n        \n        super().__setattr__(name, value)\n\n    @staticmethod\n    def from_kwargs(kwargs: dict) -> \"CrawlerRunConfig\":\n        # Auto-deserialize any dict values that use the {\"type\": ..., \"params\": ...}\n        # serialization format (e.g. from JSON API requests or dump()/load() roundtrips).\n        # This covers markdown_generator, extraction_strategy, content_filter, etc.","sourceCodeStart":2027,"sourceCodeEnd":2063,"githubUrl":"https://github.com/unclecode/crawl4ai/blob/7e801521428ee12509994d39151006f64055ebe3/crawl4ai/async_configs.py#L2027-L2063","documentation":"CrawlerRunConfig.__getattr__ raises AttributeError with a deprecation notice when you read a removed/renamed property listed in _UNWANTED_PROPS (e.g. old caching or CSS-selector fields replaced by newer APIs). The message tells you which replacement to use. Any other unknown attribute gets the standard AttributeError.","triggerScenarios":"Accessing cfg.<removed_prop> such as pre-caching or legacy selector fields present in older crawl4ai versions; running code written against an old README/docs on a new install.","commonSituations":"Upgrading crawl4ai across major versions; tutorials targeting 0.3.x APIs used with 0.4+.","solutions":["Read the deprecation text — it names the modern replacement API","Replace e.g. legacy css_selector/scan_full_page-style props with their CrawlerRunConfig counterparts in the current docs","Pin the old version if you cannot migrate yet: pip install crawl4ai==<old>"],"exampleFix":"// before\nvalue = cfg.cache_mode  # hypothetical removed prop\nprint(cfg.some_removed_prop)\n// after\nvalue = cfg.cache_mode  # current name\nprint(cfg.replacement_prop)  # per the deprecation message","handlingStrategy":"validation","validationCode":"from crawl4ai.async_configs import CrawlerRunConfig\n\nALLOWED = set(inspect.signature(CrawlerRunConfig.__init__).parameters)\ndef clean(cfg_dict: dict) -> dict:\n    return {k: v for k, v in config.items() if k in ALLOWED}","typeGuard":"def is_supported_attr(name: str) -> bool:\n    return name not in CrawlerRunConfig._UNWANTED_PROPS and name in \\\n        inspect.signature(CrawlerRunConfig.__init__).parameters","tryCatchPattern":"try:\n    v = cfg.some_old_prop\nexcept AttributeError as e:\n    if \"deprecated\" in str(e):\n        v = cfg.replacement_prop  # per message\n    else:\n        raise","preventionTips":["Run the migration guide on major-version upgrades","Filter user config dicts against the current signature","Pin versions in requirements to avoid surprise removals"],"tags":["deprecation","migration","attribute-error","versioning"],"backgroundTag":null,"analyzedSha":"7e801521428ee12509994d39151006f64055ebe3","analyzedAt":"2026-08-14T20:46:20.673Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}