{"record":{"id":"db562db7415a2912","repo":"unclecode/crawl4ai","slug":"setting-name-is-deprecated-message","errorCode":null,"errorMessage":"Setting '{name}' is deprecated. {message}","messagePattern":"Setting '(.+?)' is deprecated\\. (.+?)","errorType":"validation","errorClass":"AttributeError","httpStatus":null,"severity":"error","filePath":"crawl4ai/extraction_strategy.py","lineNumber":1818,"sourceCode":"                validation retries) are added to it in-place.\n            **kwargs: Additional args passed to LLM processor.\n\n        Returns:\n            dict: Generated schema following the JsonElementExtractionStrategy format.\n\n        Raises:\n            ValueError: If neither html nor url is provided.\n        \"\"\"\n        from .utils import aperform_completion_with_backoff, preprocess_html_for_schema\n\n        # Validate inputs\n        if html is None and (url is None or (isinstance(url, list) and len(url) == 0)):\n            raise ValueError(\"Either 'html' or 'url' must be provided\")\n\n        # Check deprecated parameters\n        for name, message in JsonElementExtractionStrategy._GENERATE_SCHEMA_UNWANTED_PROPS.items():\n            if locals()[name] is not None:\n                raise AttributeError(f\"Setting '{name}' is deprecated. {message}\")\n\n        if llm_config is None:\n            llm_config = create_llm_config()\n\n        # Save original HTML(s) before preprocessing (for validation against real HTML)\n        original_htmls = []\n\n        # Fetch HTML from URL(s) if provided\n        if url is not None:\n            from .async_webcrawler import AsyncWebCrawler\n            from .async_configs import BrowserConfig, CrawlerRunConfig, CacheMode\n\n            browser_config = BrowserConfig(\n                headless=True,\n                text_mode=True,\n                light_mode=True,\n            )\n            crawler_config = CrawlerRunConfig(cache_mode=CacheMode.BYPASS)","sourceCodeStart":1800,"sourceCodeEnd":1836,"githubUrl":"https://github.com/unclecode/crawl4ai/blob/7e801521428ee12509994d39151006f64055ebe3/crawl4ai/extraction_strategy.py#L1800-L1836","documentation":"Raised by JsonElementExtractionStrategy.generate_schema when the deprecated provider or api_token keyword arguments are passed (non-None). The method checks each name in _GENERATE_SCHEMA_UNWANTED_PROPS against locals() and raises AttributeError with migration guidance to llm_config.","triggerScenarios":"Calling generate_schema(html=..., provider='openai/gpt-4o') or generate_schema(url=..., api_token='sk-...'). Only these two names are checked; passing them as None is tolerated.","commonSituations":"Old scripts from before the LLMConfig refactor that configured the schema generator per-call; copy-pasted snippets from outdated tutorials.","solutions":["Replace provider/api_token kwargs with llm_config=LLMConfig(provider='...', api_token='...')","Search your codebase for generate_schema( calls using provider= or api_token= and migrate them all"],"exampleFix":"// before\nschema = await JsonElementExtractionStrategy.generate_schema(\n    url=u, provider=\"openai/gpt-4o\", api_token=tok)  # AttributeError\n\n// after\nfrom crawl4ai import LLMConfig\nschema = await JsonElementExtractionStrategy.generate_schema(\n    url=u, llm_config=LLMConfig(provider=\"openai/gpt-4o\", api_token=tok))","handlingStrategy":"validation","validationCode":"import inspect\n\nbanned = {\"provider\", \"api_token\"}\nsig = inspect.signature(JsonElementExtractionStrategy.generate_schema)\nkwargs = {k: v for k, v in my_kwargs.items() if k not in banned and k in sig.parameters}\nschema = await JsonElementExtractionStrategy.generate_schema(**kwargs)","typeGuard":null,"tryCatchPattern":"try:\n    schema = await JsonElementExtractionStrategy.generate_schema(html=h, **kwargs)\nexcept AttributeError as e:\n    if \"deprecated\" in str(e):\n        kwargs.pop(\"provider\", None); kwargs.pop(\"api_token\", None)\n        kwargs[\"llm_config\"] = llm_config\n        schema = await JsonElementExtractionStrategy.generate_schema(html=h, **kwargs)\n    else:\n        raise","preventionTips":["Pass LLM settings only through llm_config in generate_schema calls","Grep for generate_schema(.*provider= / api_token= when upgrading"],"tags":["extraction","schema-generation","deprecation","llm"],"backgroundTag":null,"analyzedSha":"7e801521428ee12509994d39151006f64055ebe3","analyzedAt":"2026-08-14T20:46:20.673Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}