infiniflow/ragflow · error · Exception

Request body too large: {content_length} > {limit}

Error message

Request body too large: {content_length} > {limit}

What it means

Error "Request body too large: {content_length} > {limit}" thrown in infiniflow/ragflow.

Source

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

            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
            else:
                # Single IP
                if client_ip == rule:
                    return

View on GitHub (pinned to 554fb1133a)

Solutions

  1. Send a smaller request body within the configured limit.
  2. Raise the webhook max_body_size (up to 10MB) if large payloads are expected.

Example fix

# client: check size before sending
assert len(body) <= limit

When it happens

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

Common situations: A webhook caller posts a body larger than the configured max_body_size; enforcing size limits on the client or adjusting the limit prevents this error.


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