langflow-ai/langflow · error · HTTPException
str(e)
Error message
str(e)
What it means
In POST /files/upload/{flow_id}, reading settings_service.settings.max_file_size_upload is wrapped in try/except that converts any failure into HTTP 500 with the raw exception. This only fails if the settings service is broken (attribute missing after a version mismatch, corrupt settings file, service not initialized) — the attribute itself is a plain int in healthy deployments.
Source
Thrown at src/backend/base/langflow/api/v1/files.py:105
flow: Annotated[Flow, Depends(get_flow)],
current_user: CurrentActiveUser,
storage_service: Annotated[StorageService, Depends(get_storage_service)],
settings_service: Annotated[SettingsService, Depends(get_settings_service)],
) -> UploadFileResponse:
# Writing a file to a flow's storage is a flow mutation: enforce WRITE so
# the external access ceiling (e.g. a "viewer") cannot upload via this route.
await ensure_flow_permission(
current_user,
FlowAction.WRITE,
flow_id=flow.id,
flow_user_id=flow.user_id,
workspace_id=flow.workspace_id,
folder_id=flow.folder_id,
)
try:
max_file_size_upload = settings_service.settings.max_file_size_upload
except Exception as e:
raise HTTPException(status_code=500, detail=str(e)) from e
if file.size > max_file_size_upload * 1024 * 1024:
raise HTTPException(
status_code=413, detail=f"File size is larger than the maximum file size {max_file_size_upload}MB."
)
# Authorization handled by get_flow dependency
try:
file_content = await file.read()
timestamp = datetime.now(tz=timezone.utc).astimezone().strftime("%Y-%m-%d_%H-%M-%S")
file_name = file.filename or hashlib.sha256(file_content).hexdigest()
full_file_name = f"{timestamp}_{file_name}"
folder = str(flow.id)
await storage_service.save_file(flow_id=folder, file_name=full_file_name, data=file_content)
return UploadFileResponse(flow_id=str(flow.id), file_path=f"{folder}/{full_file_name}")
except Exception as e:
raise HTTPException(status_code=500, detail=str(e)) from e
View on GitHub (pinned to 976ec789d2)
Solutions
- Check the detail text for the AttributeError/settings error and fix the settings source (config dir, settings.json)
- After upgrading Langflow, ensure backend package and settings schema are from the same version
- Explicitly set LANGFLOW_MAX_FILE_SIZE_UPLOAD so the attribute resolves from env
Example fix
# before: settings.json from older version missing the key # after: force the value via env export LANGFLOW_MAX_FILE_SIZE_UPLOAD=100
Defensive patterns
Strategy: try-catch
Try / catch
try:
upload = client.post(f"/files/upload/{flow_id}", files=files)
except HTTPError as e:
if e.response.status_code == 500 and "max_file_size_upload" in e.response.text:
alert_settings_schema_mismatch()
raise Prevention
- Keep langflow-base and settings file versions in lockstep in deployments
- Set LANGFLOW_MAX_FILE_SIZE_UPLOAD explicitly to guarantee the attribute exists
When it happens
Trigger: Uploading a file while the settings service failed to load; running a backend where the settings schema lost max_file_size_upload (fork/version skew); corrupt config causing attribute access to raise.
Common situations: Pinned forks missing newer settings fields; partially upgraded installs; config dir unreadable so settings fell back to a broken object.
Related errors
- {str(e)}
- File size is larger than the maximum file size {max_file_siz
- Extension not found for file {file_name}
- Content type not found for extension {extension}
- Content type {content_type} is not an image
AI-assisted analysis of langflow-ai/langflow@976ec789d2 (2026-08-14).
Data as JSON: /api/errors/693989be0fe53248.
Report an issue: GitHub.