infiniflow/ragflow · error · Exception

max_body_size exceeds maximum allowed size (10MB)

Error message

max_body_size exceeds maximum allowed size (10MB)

What it means

Error "max_body_size exceeds maximum allowed size (10MB)" thrown in infiniflow/ragflow.

Source

Thrown at api/apps/restful_apis/agent_api.py:1946

    async def _validate_max_body_size(security_cfg):
        """Check request size does not exceed max_body_size."""
        max_size = security_cfg.get("max_body_size")
        if not max_size:
            max_size = "10MB"

        # Convert "10MB" → bytes
        units = {"kb": 1024, "mb": 1024**2}
        size_str = max_size.lower()

        for suffix, factor in units.items():
            if size_str.endswith(suffix):
                limit = int(size_str.replace(suffix, "")) * factor
                break
        else:
            raise Exception("Invalid max_body_size format")
        MAX_LIMIT = 10 * 1024 * 1024  # 10MB
        if limit > MAX_LIMIT:
            raise Exception("max_body_size exceeds maximum allowed size (10MB)")

        content_length = request.content_length or 0
        if content_length > limit:
            raise Exception(f"Request body too large: {content_length} > {limit}")

    def _validate_ip_whitelist(security_cfg):
        """Allow only IPs listed in ip_whitelist."""
        whitelist = security_cfg.get("ip_whitelist", [])
        if not whitelist:
            return

        client_ip = request.remote_addr

        for rule in whitelist:
            if "/" in rule:
                # CIDR notation
                if ipaddress.ip_address(client_ip) in ipaddress.ip_network(rule, strict=False):
                    return

View on GitHub (pinned to 554fb1133a)

Solutions

  1. Lower max_body_size to 10MB or less.

Example fix

webhook_config = {'max_body_size': '10MB'}

When it happens

Trigger: Thrown at api/apps/restful_apis/agent_api.py:1946 when the library encounters an invalid state.

Common situations: The configured webhook body limit exceeds the hard 10MB cap; reducing the limit prevents this error.


AI-assisted analysis of infiniflow/ragflow@554fb1133a (2026-08-15). Data as JSON: /api/errors/c69f6ac863655315. Report an issue: GitHub.