{"record":{"id":"70e25056ed8bd49f","repo":"langflow-ai/langflow","slug":"file-size-is-larger-than-the-maximum-file-size-ma-70e250","errorCode":null,"errorMessage":"File size is larger than the maximum file size {max_file_size_upload}MB.","messagePattern":"File size is larger than the maximum file size (.+?)MB\\.","errorType":"http","errorClass":"HTTPException","httpStatus":413,"severity":"warning","filePath":"src/backend/base/langflow/api/v1/files.py","lineNumber":108,"sourceCode":"    settings_service: Annotated[SettingsService, Depends(get_settings_service)],\n) -> UploadFileResponse:\n    # Writing a file to a flow's storage is a flow mutation: enforce WRITE so\n    # the external access ceiling (e.g. a \"viewer\") cannot upload via this route.\n    await ensure_flow_permission(\n        current_user,\n        FlowAction.WRITE,\n        flow_id=flow.id,\n        flow_user_id=flow.user_id,\n        workspace_id=flow.workspace_id,\n        folder_id=flow.folder_id,\n    )\n    try:\n        max_file_size_upload = settings_service.settings.max_file_size_upload\n    except Exception as e:\n        raise HTTPException(status_code=500, detail=str(e)) from e\n\n    if file.size > max_file_size_upload * 1024 * 1024:\n        raise HTTPException(\n            status_code=413, detail=f\"File size is larger than the maximum file size {max_file_size_upload}MB.\"\n        )\n\n    # Authorization handled by get_flow dependency\n    try:\n        file_content = await file.read()\n        timestamp = datetime.now(tz=timezone.utc).astimezone().strftime(\"%Y-%m-%d_%H-%M-%S\")\n        file_name = file.filename or hashlib.sha256(file_content).hexdigest()\n        full_file_name = f\"{timestamp}_{file_name}\"\n        folder = str(flow.id)\n        await storage_service.save_file(flow_id=folder, file_name=full_file_name, data=file_content)\n        return UploadFileResponse(flow_id=str(flow.id), file_path=f\"{folder}/{full_file_name}\")\n    except Exception as e:\n        raise HTTPException(status_code=500, detail=str(e)) from e\n\n\n@router.get(\"/download/{flow_id}/{file_name}\")\nasync def download_file(","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/langflow-ai/langflow/blob/976ec789d2886a86de109c044d089d68e96c9a35/src/backend/base/langflow/api/v1/files.py#L90-L126","documentation":"HTTP 413 from POST /files/upload/{flow_id} when file.size exceeds max_file_size_upload (interpreted as MB, multiplied by 1024*1024). This is the configured upload ceiling from settings; the message includes the active limit so the client knows the bound. Note the check uses the declared UploadFile size, checked before reading the body.","triggerScenarios":"Uploading any file larger than LANGFLOW_MAX_FILE_SIZE_UPLOAD MB (default typically 100MB) to a flow you own; large PDFs/datasets for document loaders; raising the setting but not restarting the backend.","commonSituations":"Feeding big knowledge-base files; users hitting the default cap on self-hosted instances; env var typo (wrong name) so the old limit still applies.","solutions":["Set LANGFLOW_MAX_FILE_SIZE_UPLOAD=<larger MB> and restart the backend, then retry","Split or compress the file below the reported limit before upload","If behind a reverse proxy, also raise the proxy's client_max_body_size so the 413 comes from Langflow with this message rather than nginx"],"exampleFix":"# before\nLANGFLOW_MAX_FILE_SIZE_UPLOAD=100  # file is 250MB -> 413\n\n# after\nLANGFLOW_MAX_FILE_SIZE_UPLOAD=500\n# restart langflow","handlingStrategy":"validation","validationCode":"import os\n\ndef within_upload_limit(file_path: str) -> bool:\n    limit_mb = int(os.environ.get(\"LANGFLOW_MAX_FILE_SIZE_UPLOAD\", 100))\n    return os.path.getsize(file_path) <= limit_mb * 1024 * 1024","typeGuard":null,"tryCatchPattern":"try:\n    client.post(f\"/files/upload/{flow_id}\", files=files).raise_for_status()\nexcept HTTPError as e:\n    if e.response.status_code == 413:\n        split_file_or_raise_limit(files)","preventionTips":["Check file size client-side before starting the upload","Sync your client limit constant with the server's LANGFLOW_MAX_FILE_SIZE_UPLOAD","Chunk or compress large documents before upload"],"tags":["files","upload","http-413","size-limit"],"backgroundTag":null,"analyzedSha":"976ec789d2886a86de109c044d089d68e96c9a35","analyzedAt":"2026-08-14T18:23:12.227Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}