D4Vinci/Scrapling · error · AttributeError

Unknown parser argument: "{key}"; maybe you meant {cls.parse

Error message

Unknown parser argument: "{key}"; maybe you meant {cls.parser_keywords}?

What it means

Raised by BaseFetcher.configure() when a keyword names an attribute that exists on the class but is not one of the tunable parser keywords. hasattr(cls, key) is true (the name collides with a class member like 'configure', 'display_config', or any future class attribute), but since key not in parser_keywords it refuses to setattr — hence AttributeError with the 'maybe you meant' hint listing valid keywords.

Source

Thrown at scrapling/engines/toolbelt/custom.py:206

            storage=cls.storage,
            storage_args=cls.storage_args,
            adaptive_domain=cls.adaptive_domain,
        )

    @classmethod
    def configure(cls, **kwargs):
        """Set multiple arguments for the parser at once globally

        :param kwargs: The keywords can be any arguments of the following: huge_tree, keep_comments, keep_cdata, adaptive, storage, storage_args, adaptive_domain
        """
        for key, value in kwargs.items():
            key = key.strip().lower()
            if hasattr(cls, key):
                if key in cls.parser_keywords:
                    setattr(cls, key, value)
                else:
                    # Yup, no fun allowed LOL
                    raise AttributeError(f'Unknown parser argument: "{key}"; maybe you meant {cls.parser_keywords}?')
            else:
                raise ValueError(f'Unknown parser argument: "{key}"; maybe you meant {cls.parser_keywords}?')

        if not kwargs:
            raise AttributeError(f"You must pass a keyword to configure, current keywords: {cls.parser_keywords}?")

    @classmethod
    def _generate_parser_arguments(cls) -> Dict:
        # Selector class parameters
        # I won't validate Selector's class parameters here again, I will leave it to be validated later
        parser_arguments = dict(
            huge_tree=cls.huge_tree,
            keep_comments=cls.keep_comments,
            keep_cdata=cls.keep_cdata,
            adaptive=cls.adaptive,
            storage=cls.storage,
            storage_args=cls.storage_args,
            adaptive_domain=cls.adaptive_domain,

View on GitHub (pinned to 5d213a2d47)

Solutions

  1. Use only the seven parser keywords listed in the error: huge_tree, keep_comments, keep_cdata, adaptive, storage, storage_args, adaptive_domain.
  2. Set request-level options on the fetcher instance/session (e.g., Fetcher(proxy=..., stealth=True)), not via configure().
  3. Check the hint in the message — it prints the accepted tuple.

Example fix

# before
Fetcher.configure(configure=True, adaptive=True)  # AttributeError

# after
Fetcher.configure(adaptive=True, huge_tree=False)
Defensive patterns

Strategy: validation

Validate before calling

from scrapling.engines.toolbelt.custom import BaseFetcher

def safe_configure(**kwargs):
    bad = [k for k in kwargs if k not in BaseFetcher.parser_keywords]
    if bad:
        raise ValueError(f'Invalid parser options {bad}; allowed: {BaseFetcher.parser_keywords}')
    BaseFetcher.configure(**kwargs)

Type guard

def is_parser_keyword(key: str) -> bool:
    from scrapling.engines.toolbelt.custom import BaseFetcher
    return key.strip().lower() in BaseFetcher.parser_keywords

Try / catch

try:
    Fetcher.configure(**options)
except (AttributeError, ValueError) as e:
    if 'Unknown parser argument' in str(e):
        logger.error('bad configure keys: %s', list(options))
    raise

Prevention

When it happens

Trigger: Calling Fetcher.configure(configure=True), .configure(display_config=...), or passing any class-attribute name that isn't in parser_keywords (huge_tree, keep_comments, keep_cdata, adaptive, storage, storage_args, adaptive_domain).

Common situations: Trying to set fetching options (proxy, stealth, timeout) through configure() instead of the fetcher constructor; guessing an option name that happens to match a method on the class.

Related errors


AI-assisted analysis of D4Vinci/Scrapling@5d213a2d47 (2026-08-14). Data as JSON: /api/errors/611d7d7885d66307. Report an issue: GitHub.