unclecode/crawl4ai · error · AttributeError
Setting '{name}' is deprecated. {self._UNWANTED_PROPS[name]}
Error message
Setting '{name}' is deprecated. {self._UNWANTED_PROPS[name]} What it means
AttributeError from CrawlerRunConfig.__setattr__: assigning to a _UNWANTED_PROPS name is rejected unless the assigned value equals the __init__ default for that parameter (which lets internal default assignment pass). The message carries the migration hint.
Source
Thrown at crawl4ai/async_configs.py:2055:1042
# Experimental Parameters
self.experimental = experimental or {}
def __getattr__(self, name):
"""Handle attribute access."""
if name in self._UNWANTED_PROPS:
raise AttributeError(f"Getting '{name}' is deprecated. {self._UNWANTED_PROPS[name]}")
raise AttributeError(f"'{self.__class__.__name__}' has no attribute '{name}'")
def __setattr__(self, name, value):
"""Handle attribute setting."""
# TODO: Planning to set properties dynamically based on the __init__ signature
sig = inspect.signature(self.__init__)
all_params = sig.parameters # Dictionary of parameter names and their details
if name in self._UNWANTED_PROPS and value is not all_params[name].default:
raise AttributeError(f"Setting '{name}' is deprecated. {self._UNWANTED_PROPS[name]}")
super().__setattr__(name, value)
@staticmethod
def from_kwargs(kwargs: dict) -> "CrawlerRunConfig":
return CrawlerRunConfig(
# Content Processing Parameters
word_count_threshold=kwargs.get("word_count_threshold", 200),
extraction_strategy=kwargs.get("extraction_strategy"),
chunking_strategy=kwargs.get("chunking_strategy", RegexChunking()),
markdown_generator=kwargs.get("markdown_generator"),
only_text=kwargs.get("only_text", False),
css_selector=kwargs.get("css_selector"),
target_elements=kwargs.get("target_elements", []),
excluded_tags=kwargs.get("excluded_tags", []),
excluded_selector=kwargs.get("excluded_selector", ""),
keep_data_attributes=kwargs.get("keep_data_attributes", False),
keep_attrs=kwargs.get("keep_attrs", []),View on GitHub (pinned to 7e80152142)
Solutions
- Pass the option in the CrawlerRunConfig(...) constructor using its current name instead of assigning after creation
- Delete stale keys before restoring persisted configs: {k: v for k, v in saved.items() if k not in DEPRECATED_NAMES}
- Follow the migration hint in the error message to find the new attribute
- Catch AttributeError around config restore to detect legacy payloads early and re-map them
Example fix
# before config = CrawlerRunConfig() config.old_option = True # AttributeError: deprecated # after config = CrawlerRunConfig(new_option=True)
Defensive patterns
Strategy: validation
Validate before calling
import inspect
sig = inspect.signature(CrawlerRunConfig.__init__)
allowed = set(sig.parameters) - set(CrawlerRunConfig._UNWANTED_PROPS)
payload = {k: v for k, v in saved_config.items() if k in allowed}
config = CrawlerRunConfig(**payload) # construct, don't setattr Type guard
def is_assignable_config_key(name: str) -> bool:
return name not in CrawlerRunConfig._UNWANTED_PROPS Try / catch
try:
setattr(config, name, value)
except AttributeError as e:
if "deprecated" in str(e):
new_key = MIGRATION_MAP[name]
config = CrawlerRunConfig(**{**asdict_like(config), new_key: value})
else:
raise Prevention
- Treat configs as immutable: build them via the constructor, never mutate after the fact
- Strip deprecated keys when persisting/restoring configs, and pin the schema version alongside
When it happens
Trigger: config = CrawlerRunConfig(); then config.<removed prop> = value for any deprecated name with a non-default value; dynamic frameworks (dataclasses, ORMs, serializers) that setattr every field of a loaded object also trip this when the object carries a legacy key.
Common situations: Post-construction mutation of config with old attribute names after a version upgrade; deserializing a saved/persisted CrawlerRunConfig from an older crawl4ai; framework __setstate__-style restoration that replays legacy fields.
Related errors
- Getting '{name}' is deprecated. {self._UNWANTED_PROPS[name]}
- Getting '{name}' is deprecated. {self._UNWANTED_PROPS[name]}
- Setting '{name}' is deprecated. {self._UNWANTED_PROPS[name]}
- extraction_strategy must be an instance of ExtractionStrateg
- chunking_strategy must be an instance of ChunkingStrategy
AI-assisted analysis of unclecode/crawl4ai@7e80152142 (2026-08-14).
Data as JSON: /api/errors/bc642138a7ab7c69.
Report an issue: GitHub.