{"record":{"id":"90b76850259f507b","repo":"langflow-ai/langflow","slug":"file-uploaded-file-filename-exceeds-the-maximum","errorCode":null,"errorMessage":"File {uploaded_file.filename} exceeds the maximum upload size of {max_file_size_upload}MB","messagePattern":"File (.+?) exceeds the maximum upload size of (.+?)MB","errorType":"http","errorClass":"HTTPException","httpStatus":413,"severity":"error","filePath":"src/backend/base/langflow/api/v1/knowledge_bases.py","lineNumber":1052,"sourceCode":"    \"\"\"\n    _kb_guard = await _guard_kb_action(current_user=current_user, action=KnowledgeBaseAction.INGEST, kb_name=kb_name)\n    _assert_kb_not_memory_base(kb_name, _kb_guard.owner_user)\n    try:\n        settings = get_settings_service().settings\n        max_file_size_upload = settings.max_file_size_upload\n\n        # Parse + validate metadata before reading any file bytes so a bad\n        # metadata payload fails fast with 422 instead of paying the upload\n        # cost first.\n        run_metadata = parse_user_metadata(metadata)\n        per_file_metadata_dict = parse_per_file_metadata(per_file_metadata)\n\n        files_data = []\n\n        for uploaded_file in files:\n            file_size = uploaded_file.size\n            if file_size > max_file_size_upload * 1024 * 1024:\n                raise HTTPException(\n                    status_code=413,\n                    detail=f\"File {uploaded_file.filename} exceeds the maximum upload size of {max_file_size_upload}MB\",\n                )\n            content = await uploaded_file.read()\n            files_data.append((uploaded_file.filename or \"unknown\", content))\n\n        kb_path = _resolve_kb_path(kb_name, _kb_guard.owner_user)\n\n        # Parse and persist column_config from FormData if provided\n        if column_config:\n            try:\n                column_config_parsed = json.loads(column_config)\n                if isinstance(column_config_parsed, list):\n                    # Update embedding_metadata.json\n                    cc_metadata_path = kb_path / \"embedding_metadata.json\"\n                    if cc_metadata_path.exists():\n                        existing_meta = json.loads(cc_metadata_path.read_text())\n                        existing_meta[\"column_config\"] = column_config_parsed","sourceCodeStart":1034,"sourceCodeEnd":1070,"githubUrl":"https://github.com/langflow-ai/langflow/blob/976ec789d2886a86de109c044d089d68e96c9a35/src/backend/base/langflow/api/v1/knowledge_bases.py#L1034-L1070","documentation":"Raised by the knowledge-base file upload endpoint when an uploaded file's size exceeds the server-configured maximum upload size (max_file_size_upload, in MB, from Langflow settings). It is a 413 Payload Too Large returned per-file while iterating the multipart upload, before any bytes are read into memory. Only files over the limit fail; the whole request is aborted at the first offending file.","triggerScenarios":"POST multipart upload of one or more files to /api/v1/knowledge_bases/{kb_name}/upload (file ingest) where any uploaded_file.size > max_file_size_upload * 1024 * 1024. The check runs before uploaded_file.read(), so a single oversized file in a multi-file batch rejects the entire request.","commonSituations":"Default Langflow max_file_size_upload is small (a few MB), so PDFs, datasets, or model files routinely exceed it. Operators behind reverse proxies (nginx client_max_body_size) may see a different error first. Users uploading batches where one large file slips in.","solutions":["Increase the limit in settings: set max_file_size_upload (env LANGFLOW_MAX_FILE_SIZE_UPLOAD or via settings UI/config) to a value large enough for your largest file, then restart the backend.","Pre-filter files client-side so the batch only contains files under max_file_size_upload MB, and split large files out.","For oversized documents, chunk/split the file or ingest via the folder-ingest endpoint if the operator's per-file limit there is higher.","If behind a proxy, also raise its body-size limit (e.g. nginx client_max_body_size) to match."],"exampleFix":"# before: uploading a 200MB file with default limit\nawait client.post(f\"/api/v1/knowledge_bases/{kb}/upload\", files=files)\n\n# after: raise server limit in settings\n# LANGFLOW_MAX_FILE_SIZE_UPLOAD=500\n# and check client-side before uploading\nimport os\nMAX_MB = 100\nfiles = [(name, f) for name, f in files if os.path.getsize(f.name) <= MAX_MB * 1024 * 1024]","handlingStrategy":"validation","validationCode":"import os\n\nMAX_MB = int(os.environ.get(\"LANGFLOW_MAX_FILE_SIZE_UPLOAD\", \"100\"))\n\ndef filter_uploadable(paths: list[str]) -> list[str]:\n    return [p for p in paths if os.path.getsize(p) <= MAX_MB * 1024 * 1024]","typeGuard":null,"tryCatchPattern":"try:\n    resp = await client.post(f\"/api/v1/knowledge_bases/{kb}/upload\", files=files)\nexcept HTTPError as e:\n    if e.response.status_code == 413:\n        # split oversized files out of the batch and retry with the rest\n        ...","preventionTips":["Set max_file_size_upload to match your largest expected document before bulk ingestion.","Always check file sizes client-side before building the multipart request.","Keep one oversized file from poisoning a whole batch by uploading files individually or pre-filtering."],"tags":["upload","file-size","knowledge-base","http-413"],"backgroundTag":null,"analyzedSha":"976ec789d2886a86de109c044d089d68e96c9a35","analyzedAt":"2026-08-14T18:23:12.227Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}