unclecode/crawl4ai · error · AttributeError

Getting '{name}' is deprecated. {self._UNWANTED_PROPS[name]}

Error message

Getting '{name}' is deprecated. {self._UNWANTED_PROPS[name]}

What it means

AttributeError from CrawlerRunConfig.__getattr__: reading an attribute listed in _UNWANTED_PROPS - properties removed in the current version - is blocked, and the message includes a migration hint. Non-listed unknown attributes fall through to the normal 'no attribute' error.

Source

Thrown at crawl4ai/async_configs.py:2045:1032

            raise ValueError(
                "chunking_strategy must be an instance of ChunkingStrategy"
            )

        # Set default chunking strategy if None
        if self.chunking_strategy is None:
            self.chunking_strategy = RegexChunking()

        # Deep Crawl Parameters
        self.deep_crawl_strategy = deep_crawl_strategy
        
        # 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),

View on GitHub (pinned to 7e80152142)

Solutions

  1. Read the migration hint in the message itself - it states what replaced the property
  2. Update the call site to set the option at construction with its current name
  3. Search your code for the removed name and fix every access (rg '<name>' .)
  4. Pin the old crawl4ai version only as a last resort while you migrate

Example fix

# before (legacy)
val = config.old_option  # AttributeError: deprecated

# after
from crawl4ai import CrawlerRunConfig
config = CrawlerRunConfig(new_option=True)
val = config.new_option
Defensive patterns

Strategy: try-catch

Validate before calling

# before any generic attribute access on configs
DEPRECATED = set(CrawlerRunConfig._UNWANTED_PROPS)
name = MIGRATION_MAP[name] if name in DEPRECATED else name

Type guard

def safe_config_get(config, name, default=None):
    if name in config._UNWANTED_PROPS:
        raise KeyError(f"{name} removed; see migration map")
    return getattr(config, name, default)

Try / catch

try:
    val = getattr(config, prop)
except AttributeError as e:
    if "deprecated" in str(e):
        val = MIGRATION_MAP_lookup(prop, str(e))  # parse the hint in the message
    else:
        raise

Prevention

When it happens

Trigger: Reading config.<removed prop> where <removed prop> is in _UNWANTED_PROPS (e.g. legacy option names relocated into CrawlerRunConfig/BrowserConfig), including indirect reads via getattr(config, name) in shared utility code.

Common situations: Upgrading crawl4ai a major version and running old scripts or third-party code written against the legacy API; copy-pasted snippets referencing options that were renamed.

Related errors


AI-assisted analysis of unclecode/crawl4ai@7e80152142 (2026-08-14). Data as JSON: /api/errors/742385a7f399e1ca. Report an issue: GitHub.