langflow-ai/langflow · error · HTTPException
File {uploaded_file.filename} exceeds the maximum upload siz
Error message
File {uploaded_file.filename} exceeds the maximum upload size of {max_file_size_upload}MB What it means
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.
Source
Thrown at src/backend/base/langflow/api/v1/knowledge_bases.py:1052
"""
_kb_guard = await _guard_kb_action(current_user=current_user, action=KnowledgeBaseAction.INGEST, kb_name=kb_name)
_assert_kb_not_memory_base(kb_name, _kb_guard.owner_user)
try:
settings = get_settings_service().settings
max_file_size_upload = settings.max_file_size_upload
# Parse + validate metadata before reading any file bytes so a bad
# metadata payload fails fast with 422 instead of paying the upload
# cost first.
run_metadata = parse_user_metadata(metadata)
per_file_metadata_dict = parse_per_file_metadata(per_file_metadata)
files_data = []
for uploaded_file in files:
file_size = uploaded_file.size
if file_size > max_file_size_upload * 1024 * 1024:
raise HTTPException(
status_code=413,
detail=f"File {uploaded_file.filename} exceeds the maximum upload size of {max_file_size_upload}MB",
)
content = await uploaded_file.read()
files_data.append((uploaded_file.filename or "unknown", content))
kb_path = _resolve_kb_path(kb_name, _kb_guard.owner_user)
# Parse and persist column_config from FormData if provided
if column_config:
try:
column_config_parsed = json.loads(column_config)
if isinstance(column_config_parsed, list):
# Update embedding_metadata.json
cc_metadata_path = kb_path / "embedding_metadata.json"
if cc_metadata_path.exists():
existing_meta = json.loads(cc_metadata_path.read_text())
existing_meta["column_config"] = column_config_parsedView on GitHub (pinned to 976ec789d2)
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.
Example fix
# before: uploading a 200MB file with default limit
await client.post(f"/api/v1/knowledge_bases/{kb}/upload", files=files)
# after: raise server limit in settings
# LANGFLOW_MAX_FILE_SIZE_UPLOAD=500
# and check client-side before uploading
import os
MAX_MB = 100
files = [(name, f) for name, f in files if os.path.getsize(f.name) <= MAX_MB * 1024 * 1024] Defensive patterns
Strategy: validation
Validate before calling
import os
MAX_MB = int(os.environ.get("LANGFLOW_MAX_FILE_SIZE_UPLOAD", "100"))
def filter_uploadable(paths: list[str]) -> list[str]:
return [p for p in paths if os.path.getsize(p) <= MAX_MB * 1024 * 1024] Try / catch
try:
resp = await client.post(f"/api/v1/knowledge_bases/{kb}/upload", files=files)
except HTTPError as e:
if e.response.status_code == 413:
# split oversized files out of the batch and retry with the rest
... Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- File size is larger than the maximum file size {max_file_siz
- File too large
- Metadata value for '{key}' exceeds {KB_METADATA_MAX_VALUE_LE
- Metadata array '{key}' exceeds {KB_METADATA_MAX_ARRAY_LENGTH
- Metadata array '{key}' must contain only strings.
AI-assisted analysis of langflow-ai/langflow@976ec789d2 (2026-08-14).
Data as JSON: /api/errors/90b76850259f507b.
Report an issue: GitHub.