unclecode/crawl4ai · error · AttributeError

The 'fit_html' attribute is deprecated and has been removed.

Error message

The 'fit_html' attribute is deprecated and has been removed. Please use 'markdown.fit_html' instead.

What it means

Error "The 'fit_html' attribute is deprecated and has been removed. Please use 'markdown.fit_html' instead." thrown in unclecode/crawl4ai.

Source

Thrown at crawl4ai/models.py:242

            """
        )
    
    @property
    def fit_markdown(self):
        """
        Deprecated property that raises an AttributeError when accessed.
        """
        raise AttributeError(
            "The 'fit_markdown' attribute is deprecated and has been removed. "
            "Please use 'markdown.fit_markdown' instead."
        )
    
    @property
    def fit_html(self):
        """
        Deprecated property that raises an AttributeError when accessed.
        """
        raise AttributeError(
            "The 'fit_html' attribute is deprecated and has been removed. "
            "Please use 'markdown.fit_html' instead."
        )

    def model_dump(self, *args, **kwargs):
        """
        Override model_dump to include the _markdown private attribute in serialization.
        
        This override is necessary because:
        1. PrivateAttr fields are excluded from serialization by default
        2. We need to maintain backward compatibility by including the 'markdown' field
           in the serialized output
        3. We're transitioning from 'markdown_v2' to enhancing 'markdown' to hold
           the same type of data
        
        Future developers: This method ensures that the markdown content is properly
        serialized despite being stored in a private attribute. If the serialization
        requirements change, this is where you would update the logic.

View on GitHub (pinned to 7e80152142)

Solutions

  1. Use result.markdown.fit_html instead of the removed fit_html attribute.

Example fix

fit_html = result.markdown.fit_html

When it happens

Trigger: Thrown at crawl4ai/models.py:242 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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