{"record":{"id":"a6d89001090e67de","repo":"infiniflow/ragflow","slug":"invalid-max-body-size-format","errorCode":null,"errorMessage":"Invalid max_body_size format","messagePattern":"Invalid max_body_size format","errorType":"exception","errorClass":"Exception","httpStatus":400,"severity":"error","filePath":"api/apps/restful_apis/agent_api.py","lineNumber":1943,"sourceCode":"        else:\n            raise Exception(f\"Unsupported auth_type: {auth_type}\")\n\n    async def _validate_max_body_size(security_cfg):\n        \"\"\"Check request size does not exceed max_body_size.\"\"\"\n        max_size = security_cfg.get(\"max_body_size\")\n        if not max_size:\n            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:","sourceCodeStart":1925,"sourceCodeEnd":1961,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/api/apps/restful_apis/agent_api.py#L1925-L1961","documentation":"Error \"Invalid max_body_size format\" thrown in infiniflow/ragflow.","triggerScenarios":"Thrown at api/apps/restful_apis/agent_api.py:1943 when the library encounters an invalid state.","commonSituations":"The webhook max_body_size uses an unrecognized unit or non-numeric value; using the documented size format prevents this error.","solutions":["Set max_body_size to a valid size string (e.g. '1MB', '512KB').","Check the accepted format in the webhook configuration docs."],"exampleFix":"webhook_config = {'max_body_size': '1MB'}","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-15T22:17:37.221Z"}