{"record":{"id":"8f501d5961926b20","repo":"unclecode/crawl4ai","slug":"setting-name-is-deprecated-self-unwanted-pr-8f501d","errorCode":null,"errorMessage":"Setting '{name}' is deprecated. {self._UNWANTED_PROPS[name]}","messagePattern":"Setting '(.+?)' is deprecated\\. (.+?)","errorType":"validation","errorClass":"AttributeError","httpStatus":null,"severity":"error","filePath":"crawl4ai/extraction_strategy.py","lineNumber":637,"sourceCode":"            self.chunk_token_threshold = 1e9\n        self.verbose = verbose\n        self.usages = []  # Store individual usages\n        self.total_usage = TokenUsage()  # Accumulated usage\n\n        self.provider = provider\n        self.api_token = api_token\n        self.base_url = base_url\n        self.api_base = api_base\n\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    def extract(self, url: str, ix: int, html: str) -> List[Dict[str, Any]]:\n        \"\"\"\n        Extract meaningful blocks or chunks from the given HTML using an LLM.\n\n        How it works:\n        1. Construct a prompt with variables.\n        2. Make a request to the LLM using the prompt.\n        3. Parse the response and extract blocks or chunks.\n\n        Args:\n            url: The URL of the webpage.\n            ix: Index of the block.\n            html: The HTML content of the webpage.\n\n        Returns:","sourceCodeStart":619,"sourceCodeEnd":655,"githubUrl":"https://github.com/unclecode/crawl4ai/blob/7e801521428ee12509994d39151006f64055ebe3/crawl4ai/extraction_strategy.py#L619-L655","documentation":"Raised by LLMExtractionStrategy.__setattr__ when you assign a value to provider, api_token, base_url, or api_base and that value differs from the __init__ default. These per-instance attributes are deprecated; the check intercepts any non-default assignment so old code that sets strategy.provider = '...' fails fast with guidance to use llm_config=LLMConfig(...).","triggerScenarios":"strategy.provider = 'openai/gpt-4o' or passing provider='...' to __init__ with a non-default value; similarly for api_token, base_url, api_base. The AttributeError fires at assignment time (including during __init__), not at extraction time.","commonSituations":"Code written for crawl4ai < 0.5 that configured LLM strategies with individual constructor kwargs; tutorials showing strategy.api_token = os.environ['OPENAI_API_KEY'].","solutions":["Move all LLM settings into LLMConfig: LLMDExtractionStrategy(llm_config=LLMConfig(provider='openai/gpt-4o', api_token='...'))","Remove any post-construction assignments like strategy.provider = ...","Keep llm_config in one place (e.g. env-driven) and reuse it across strategies"],"exampleFix":"// before\nstrategy = LLMExtractionStrategy(provider=\"openai/gpt-4o\", api_token=token)\n# AttributeError: Setting 'provider' is deprecated\n\n// after\nfrom crawl4ai import LLMConfig\nstrategy = LLMExtractionStrategy(llm_config=LLMConfig(provider=\"openai/gpt-4o\", api_token=token))","handlingStrategy":"validation","validationCode":"from crawl4ai.async_configs import LLMConfig\n\n# build the single config object; never set provider/api_token on the strategy\nllm_config = LLMConfig(provider=\"openai/gpt-4o\", api_token=os.environ[\"OPENAI_API_KEY\"])\nstrategy = LLMExtractionStrategy(llm_config=llm_config, instruction=\"...\")","typeGuard":null,"tryCatchPattern":"try:\n    strategy = LLMExtractionStrategy(llm_config=cfg, instruction=ins)\nexcept AttributeError as e:\n    if \"deprecated\" in str(e):\n        migrate_to_llm_config()  # strip provider/api_token kwargs and rebuild\n    raise","preventionTips":["Configure LLMs exclusively via LLMLConfig","Grep codebases for '.provider =', '.api_token =', 'base_url=' on strategy objects after upgrading crawl4ai","Follow the 0.5+ migration notes when upgrading"],"tags":["extraction","llm","deprecation","breaking-change"],"backgroundTag":null,"analyzedSha":"7e801521428ee12509994d39151006f64055ebe3","analyzedAt":"2026-08-14T20:46:20.673Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}