{"record":{"id":"c531d591e3ea09fb","repo":"unclecode/crawl4ai","slug":"setting-name-is-deprecated-self-unwanted-pr","errorCode":null,"errorMessage":"Setting '{name}' is deprecated. {self._UNWANTED_PROPS[name]}","messagePattern":"Setting '(.+?)' is deprecated\\. (.+?)","errorType":"exception","errorClass":"AttributeError","httpStatus":null,"severity":"warning","filePath":"crawl4ai/async_configs.py","lineNumber":2055,"sourceCode":"                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.\n        kwargs = {\n            k: from_serializable_dict(v) if isinstance(v, dict) and \"type\" in v else v\n            for k, v in kwargs.items()\n        }\n        # Only pass keys present in kwargs so that __init__ defaults (and\n        # set_defaults() overrides) are respected for missing keys.\n        valid = inspect.signature(CrawlerRunConfig.__init__).parameters.keys() - {\"self\"}\n        return CrawlerRunConfig(**{k: v for k, v in kwargs.items() if k in valid})\n\n    # Create a funciton returns dict of the object","sourceCodeStart":2037,"sourceCodeEnd":2073,"githubUrl":"https://github.com/unclecode/crawl4ai/blob/7e801521428ee12509994d39151006f64055ebe3/crawl4ai/async_configs.py#L2037-L2073","documentation":"CrawlerRunConfig.__setattr__ raises AttributeError when you assign a value to a deprecated property (listed in _UNWANTED_PROPS) that differs from its __init__ default. Assigning the default value is tolerated (for internal init), but any real attempt to set old removed settings is blocked with a pointer to the replacement.","triggerScenarios":"cfg.removed_prop = value on an upgraded install; porting old scripts that configure removed options; kwargs-splatting a legacy dict onto the config object.","commonSituations":"Version upgrades where old settings moved to cache_mode, content_filter, or LinkPreviewConfig-style nested configs; stale user-supplied config dicts.","solutions":["Follow the deprecation message and set the replacement field instead","Filter legacy keys before applying user config: drop keys listed in the deprecation map","Temporarily pin the previous crawl4ai version if immediate migration is not feasible"],"exampleFix":"// before\ncfg.old_setting = True  # removed in upgrade\n// after\ncfg.new_setting = True   # per deprecation message","handlingStrategy":"validation","validationCode":"UNWANTED = set(CrawlerRunConfig._UNWANTED_PROPS)\nfor k in list(vars(cfg)):\n    pass\n# before applying external settings:\ndef safe_set(cfg, k, v):\n    if k in CrawlerRunConfig._UNWANTED_PROPS:\n        raise DeprecationWarning(f\"{k} was removed; see docs\")\n    setattr(cfg, k, v)","typeGuard":"def settable(cfg, name: str) -> bool:\n    return name not in CrawlerRunConfig._UNWANTED_PROPS","tryCatchPattern":"try:\n    cfg.old_setting = value\nexcept AttributeError as e:\n    if \"deprecated\" in str(e):\n        migrate_setting(cfg, old=name, new=REPLACEMENTS[name])\n    else:\n        raise","preventionTips":["Map old->new setting names once in a migration table","Do not splat legacy dicts onto cfg","Test config construction in CI on the installed version"],"tags":["deprecation","migration","attribute-error","configuration"],"backgroundTag":null,"analyzedSha":"7e801521428ee12509994d39151006f64055ebe3","analyzedAt":"2026-08-14T20:46:20.673Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}