infiniflow/ragflow · error · Exception

Invalid max_body_size format

Error message

Invalid max_body_size format

What it means

Error "Invalid max_body_size format" thrown in infiniflow/ragflow.

Source

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

        else:
            raise Exception(f"Unsupported auth_type: {auth_type}")

    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:

View on GitHub (pinned to 554fb1133a)

Solutions

  1. Set max_body_size to a valid size string (e.g. '1MB', '512KB').
  2. Check the accepted format in the webhook configuration docs.

Example fix

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

When it happens

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

Common situations: The webhook max_body_size uses an unrecognized unit or non-numeric value; using the documented size format prevents this error.


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