{"record":{"id":"35aa0924e6ea5933","repo":"langflow-ai/langflow","slug":"str-e-35aa09","errorCode":null,"errorMessage":"{str(e)}","messagePattern":"\\{str\\(e\\)\\}","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"src/backend/base/langflow/api/v1/files.py","lineNumber":122,"sourceCode":"    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(\n    file_name: ValidatedFileName,\n    flow: Annotated[Flow, Depends(get_flow)],\n    storage_service: Annotated[StorageService, Depends(get_storage_service)],\n):\n    # Authorization handled by get_flow dependency\n    flow_id_str = str(flow.id)\n    extension = file_name.split(\".\")[-1]\n\n    if not extension:\n        raise HTTPException(status_code=500, detail=f\"Extension not found for file {file_name}\")\n    try:\n        content_type = build_content_type_from_extension(extension)\n    except Exception as e:\n        raise HTTPException(status_code=500, detail=str(e)) from e","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/langflow-ai/langflow/blob/976ec789d2886a86de109c044d089d68e96c9a35/src/backend/base/langflow/api/v1/files.py#L104-L140","documentation":"POST /files/upload/{flow_id} wraps file read + storage save in a broad except and returns HTTP 500 with str(e). Failures here come from the storage layer: disk full, permission denied on the storage directory, S3/remote storage misconfiguration (missing bucket/credentials when a remote storage backend is enabled), or the client disconnecting mid-read. The message is the underlying exception verbatim.","triggerScenarios":"Disk exhaustion or read-only volume at the configured storage path; LocalStorageService hitting permission errors; remote storage service failing auth; UploadFile stream aborted during await file.read().","commonSituations":"Docker containers with small volumes; S3-compatible backends with expired keys; NAS mounts dropping; uploading from flaky networks where the multipart stream truncates.","solutions":["Read detail — 'No space left on device' means expand/clean the volume; permission errors mean chown/chmod the storage dir","For remote storage, verify bucket credentials and connectivity with the storage backend's CLI","Free disk space or move LANGFLOW_CONFIG_DIR/storage to a larger volume and restart"],"exampleFix":"# before: docker volume full\ndocker run -v langflow-data:/app/.langflow ...\n\n# after\ndocker system prune -af --volumes  # or attach a larger volume at the storage path","handlingStrategy":"retry","validationCode":"import shutil\n\ndef storage_has_space(path: str, needed_bytes: int) -> bool:\n    return shutil.disk_usage(path).free >= needed_bytes","typeGuard":null,"tryCatchPattern":"try:\n    upload = client.post(f\"/files/upload/{flow_id}\", files=files)\nexcept HTTPError as e:\n    if e.response.status_code == 500:\n        detail = e.response.text\n        if \"space\" in detail or \"Permission\" in detail:\n            alert_storage_issue(detail)\n        # transient remote-storage failures: retry once after backoff\n        else:\n            upload = retry_with_backoff(lambda: client.post(f\"/files/upload/{flow_id}\", files=files))","preventionTips":["Monitor free disk space on the storage volume","Provision persistent, writable storage dirs for containers","Retry only transient backend errors; surface storage-permission errors immediately"],"tags":["files","storage","http-500","upload","disk"],"backgroundTag":null,"analyzedSha":"976ec789d2886a86de109c044d089d68e96c9a35","analyzedAt":"2026-08-14T18:23:12.227Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}