langflow-ai/langflow · error · Error
Invalid file type
Error message
Invalid file type
What it means
ValueError raised by get_composer_sse_url when the project's auth config lacks oauth_host or oauth_port — the composer SSE URL cannot be constructed without them. It is not an HTTPException, so callers that do not catch it surface it as a generic 500 (via the install/check catch-alls).
Source
Thrown at src/frontend/src/hooks/flows/use-upload-flow.ts:40
flows.push(flow);
});
} else {
flows.push(object as FlowType);
}
});
return flows;
};
const getFlowsToUpload = async ({
files,
}: {
files?: File[];
}): Promise<FlowType[]> => {
if (!files) {
files = await createFileUpload();
}
if (!files.every((file) => file.type === "application/json")) {
throw new Error("Invalid file type");
}
return await getFlowsFromFiles({
files,
});
};
const uploadFlow = async ({
files,
isComponent,
position,
}: {
files?: File[];
isComponent?: boolean;
position?: { x: number; y: number };
}): Promise<void> => {
try {
const flows = await getFlowsToUpload({ files });
for (const flow of flows) {View on GitHub (pinned to 976ec789d2)
Solutions
- Re-save OAuth settings ensuring oauth_host and oauth_port are provided (the settings UI normally collects both).
- Inspect project.auth_settings JSON and add the missing keys.
- Wrap calls to get_composer_sse_url in callers with a clearer 4xx if you control the route code.
Example fix
// before
project_sse_url = await get_composer_sse_url(project)
// after
auth_config = await _get_mcp_composer_auth_config(project)
if not auth_config.get("oauth_host") or not auth_config.get("oauth_port"):
raise HTTPException(status_code=400, detail="Set OAuth host and port before requesting the composer SSE URL")
project_sse_url = await get_composer_sse_url(project) Defensive patterns
Strategy: validation
Validate before calling
auth_config = project.auth_settings or {}
missing = [k for k in ("oauth_host", "oauth_port") if not auth_config.get(k)]
if missing:
raise ValueError(f"auth settings missing: {missing}; complete them before requesting composer URLs") Type guard
def has_composer_endpoint(auth_settings: dict) -> bool:
return bool(auth_settings.get("oauth_host")) and bool(auth_settings.get("oauth_port")) Try / catch
try:
sse_url = await get_composer_sse_url(project)
except ValueError as e:
if "OAuth host and port" in str(e):
raise HTTPException(status_code=400, detail=str(e)) from e
raise Prevention
- Enforce oauth_host/oauth_port presence in the settings form before save.
- Never hand-edit auth_settings JSON without both keys.
- Catch ValueError specifically around composer URL helpers and convert to a 400.
When it happens
Trigger: Any code path calling get_composer_sse_url(project) for a project whose auth_settings have auth_type oauth but empty/missing oauth_host/oauth_port — install endpoint, install check, or settings PATCH response building.
Common situations: OAuth settings saved without host/port fields; auth settings edited directly in the DB; version change that renamed the keys.
Related errors
- Failed to reload bundle
- Failed to download files: ${response.statusText}
- Failed to delete MCP Server
- Failed to patch MCP Server
- Langflow was not able to connect to the server. Please make
AI-assisted analysis of langflow-ai/langflow@976ec789d2 (2026-08-14).
Data as JSON: /api/errors/bcc0bbe94e5a6465.
Report an issue: GitHub.