langflow-ai/langflow · error · HTTPException
Content type not found for extension {extension}
Error message
Content type not found for extension {extension} What it means
HTTP 500 from GET /files/download/{flow_id}/{file_name} when build_content_type_from_extension returns a falsy value — the extension is syntactically fine but not present in the server's known extension→MIME map. The server refuses to guess a content type rather than defaulting, so the download cannot proceed.
Source
Thrown at src/backend/base/langflow/api/v1/files.py:143
@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
if not content_type:
raise HTTPException(status_code=500, detail=f"Content type not found for extension {extension}")
try:
file_content = await storage_service.get_file(flow_id=flow_id_str, file_name=file_name)
headers = {
"Content-Disposition": build_content_disposition(file_name),
"Content-Type": "application/octet-stream",
"Content-Length": str(len(file_content)),
}
return StreamingResponse(BytesIO(file_content), media_type=content_type, headers=headers)
except Exception as e:
raise HTTPException(status_code=500, detail=str(e)) from e
@router.get("/images/{flow_id}/{file_name}")
async def download_image(
file_name: ValidatedFileName,
# Security: resolve flow through get_flow so image access requires authentication and owner match.
flow: Annotated[Flow, Depends(get_flow)],View on GitHub (pinned to 976ec789d2)
Solutions
- Re-upload/store the file with a mapped extension (e.g. .bin or .txt) if the exact type doesn't matter
- Upgrade langflow-base so the content-type table includes the extension
- Patch build_content_type_from_extension's mapping to add the missing extension and restart
Example fix
# before
GET /files/download/{flow_id}/run_42.parquet # 500: content type not found
# after
# re-upload same bytes as run_42.bin, then
GET /files/download/{flow_id}/2024-01-01_00-00-00_run_42.bin Defensive patterns
Strategy: validation
Validate before calling
KNOWN_EXTS = {"txt", "pdf", "csv", "png", "jpg", "jpeg", "json", "zip", "bin"}
def extension_supported(file_name: str) -> bool:
return file_name.rsplit(".", 1)[-1].lower() in KNOWN_EXTS Try / catch
try:
client.get(f"/files/download/{flow_id}/{file_name}").raise_for_status()
except HTTPError as e:
if "Content type not found" in e.response.text:
client.get(f"/files/download/{flow_id}/{renamed(file_name, '.bin')}") Prevention
- Restrict uploads to extensions with known MIME mappings
- Keep a client-side extension allow-list matched to the server's table
When it happens
Trigger: Downloading a file with an extension the server has no MIME mapping for (e.g. .foo, .custom, niche formats like .parquet on older builds); files created by components with nonstandard suffixes.
Common situations: Custom file artifacts produced by flow components; older Langflow builds with smaller MIME tables; users uploading then downloading proprietary-format files.
Related errors
- Extension not found for file {file_name}
- Content type {content_type} is not an image
- str(e)
- {str(e)}
- HTTP error! status: ${response.status}
AI-assisted analysis of langflow-ai/langflow@976ec789d2 (2026-08-14).
Data as JSON: /api/errors/9a282c417274f021.
Report an issue: GitHub.