{"record":{"id":"dbe740c21f0d1589","repo":"infiniflow/ragflow","slug":"100","errorCode":"100","errorMessage":"Invalid Content-Type: expect '{content_type}', got '{ctype}'","messagePattern":"Invalid Content-Type: expect '(.+?)', got '(.+?)'","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"api/apps/restful_apis/agent_api.py","lineNumber":2128,"sourceCode":"    except Exception as e:\n        resp = get_data_error_result(code=RetCode.BAD_REQUEST, message=str(e))\n        resp.status_code = RetCode.BAD_REQUEST\n        return resp\n\n    # 7. Parse request body\n    async def parse_webhook_request(content_type):\n        \"\"\"Parse request based on content-type and return structured data.\"\"\"\n\n        # 1. Query\n        query_data = {k: v for k, v in request.args.items()}\n\n        # 2. Headers\n        header_data = {k: v for k, v in request.headers.items()}\n\n        # 3. Body\n        ctype = request.headers.get(\"Content-Type\", \"\").split(\";\")[0].strip()\n        if ctype and ctype != content_type:\n            raise ValueError(f\"Invalid Content-Type: expect '{content_type}', got '{ctype}'\")\n\n        body_data: dict = {}\n\n        try:\n            if ctype == \"application/json\":\n                body_data = await request.get_json() or {}\n\n            elif ctype == \"multipart/form-data\":\n                nonlocal canvas\n                form = await request.form\n                files = await request.files\n\n                body_data = {}\n\n                for key, value in form.items():\n                    body_data[key] = value\n\n                if len(files) > 10:","sourceCodeStart":2110,"sourceCodeEnd":2146,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/api/apps/restful_apis/agent_api.py#L2110-L2146","documentation":"Error \"Invalid Content-Type: expect '{content_type}', got '{ctype}'\" thrown in infiniflow/ragflow.","triggerScenarios":"Thrown at api/apps/restful_apis/agent_api.py:2128 when the library encounters an invalid state.","commonSituations":"The webhook caller posts with a Content-Type different from the configured expectation (e.g. form data instead of JSON); aligning the header prevents this error.","solutions":["Send the request with the Content-Type required by the webhook configuration.","Adjust the webhook content_type setting if the caller cannot change."],"exampleFix":"headers = {'Content-Type': 'application/json'}","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"}