{"record":{"id":"1c73327b7887102d","repo":"infiniflow/ragflow","slug":"request-body-too-large-content-length-limit","errorCode":null,"errorMessage":"Request body too large: {content_length} > {limit}","messagePattern":"Request body too large: (.+?) > (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":400,"severity":"error","filePath":"api/apps/restful_apis/agent_api.py","lineNumber":1950,"sourceCode":"            max_size = \"10MB\"\n\n        # Convert \"10MB\" → bytes\n        units = {\"kb\": 1024, \"mb\": 1024**2}\n        size_str = max_size.lower()\n\n        for suffix, factor in units.items():\n            if size_str.endswith(suffix):\n                limit = int(size_str.replace(suffix, \"\")) * factor\n                break\n        else:\n            raise Exception(\"Invalid max_body_size format\")\n        MAX_LIMIT = 10 * 1024 * 1024  # 10MB\n        if limit > MAX_LIMIT:\n            raise Exception(\"max_body_size exceeds maximum allowed size (10MB)\")\n\n        content_length = request.content_length or 0\n        if content_length > limit:\n            raise Exception(f\"Request body too large: {content_length} > {limit}\")\n\n    def _validate_ip_whitelist(security_cfg):\n        \"\"\"Allow only IPs listed in ip_whitelist.\"\"\"\n        whitelist = security_cfg.get(\"ip_whitelist\", [])\n        if not whitelist:\n            return\n\n        client_ip = request.remote_addr\n\n        for rule in whitelist:\n            if \"/\" in rule:\n                # CIDR notation\n                if ipaddress.ip_address(client_ip) in ipaddress.ip_network(rule, strict=False):\n                    return\n            else:\n                # Single IP\n                if client_ip == rule:\n                    return","sourceCodeStart":1932,"sourceCodeEnd":1968,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/api/apps/restful_apis/agent_api.py#L1932-L1968","documentation":"Error \"Request body too large: {content_length} > {limit}\" thrown in infiniflow/ragflow.","triggerScenarios":"Thrown at api/apps/restful_apis/agent_api.py:1950 when the library encounters an invalid state.","commonSituations":"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.","solutions":["Send a smaller request body within the configured limit.","Raise the webhook max_body_size (up to 10MB) if large payloads are expected."],"exampleFix":"# client: check size before sending\nassert len(body) <= limit","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"554fb1133ac3861732235ad9c377eb5e0a770665","analyzedAt":"2026-08-15T09:20:16.380Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}