langflow-ai/langflow · error · HTTPException

{str(e)}

Error message

{str(e)}

What it means

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.

Source

Thrown at src/backend/base/langflow/api/v1/files.py:122

    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


@router.get("/download/{flow_id}/{file_name}")
async def download_file(
    file_name: ValidatedFileName,
    flow: Annotated[Flow, Depends(get_flow)],
    storage_service: Annotated[StorageService, Depends(get_storage_service)],
):
    # Authorization handled by get_flow dependency
    flow_id_str = str(flow.id)
    extension = file_name.split(".")[-1]

    if not extension:
        raise HTTPException(status_code=500, detail=f"Extension not found for file {file_name}")
    try:
        content_type = build_content_type_from_extension(extension)
    except Exception as e:
        raise HTTPException(status_code=500, detail=str(e)) from e

View on GitHub (pinned to 976ec789d2)

Solutions

  1. Read detail — 'No space left on device' means expand/clean the volume; permission errors mean chown/chmod the storage dir
  2. For remote storage, verify bucket credentials and connectivity with the storage backend's CLI
  3. Free disk space or move LANGFLOW_CONFIG_DIR/storage to a larger volume and restart

Example fix

# before: docker volume full
docker run -v langflow-data:/app/.langflow ...

# after
docker system prune -af --volumes  # or attach a larger volume at the storage path
Defensive patterns

Strategy: retry

Validate before calling

import shutil

def storage_has_space(path: str, needed_bytes: int) -> bool:
    return shutil.disk_usage(path).free >= needed_bytes

Try / catch

try:
    upload = client.post(f"/files/upload/{flow_id}", files=files)
except HTTPError as e:
    if e.response.status_code == 500:
        detail = e.response.text
        if "space" in detail or "Permission" in detail:
            alert_storage_issue(detail)
        # transient remote-storage failures: retry once after backoff
        else:
            upload = retry_with_backoff(lambda: client.post(f"/files/upload/{flow_id}", files=files))

Prevention

When it happens

Trigger: 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().

Common situations: Docker containers with small volumes; S3-compatible backends with expired keys; NAS mounts dropping; uploading from flaky networks where the multipart stream truncates.

Related errors


AI-assisted analysis of langflow-ai/langflow@976ec789d2 (2026-08-14). Data as JSON: /api/errors/35aa0924e6ea5933. Report an issue: GitHub.