{"record":{"id":"bcc0bbe94e5a6465","repo":"langflow-ai/langflow","slug":"invalid-file-type","errorCode":null,"errorMessage":"Invalid file type","messagePattern":"Invalid file type","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/frontend/src/hooks/flows/use-upload-flow.ts","lineNumber":40,"sourceCode":"          flows.push(flow);\n        });\n      } else {\n        flows.push(object as FlowType);\n      }\n    });\n    return flows;\n  };\n\n  const getFlowsToUpload = async ({\n    files,\n  }: {\n    files?: File[];\n  }): Promise<FlowType[]> => {\n    if (!files) {\n      files = await createFileUpload();\n    }\n    if (!files.every((file) => file.type === \"application/json\")) {\n      throw new Error(\"Invalid file type\");\n    }\n    return await getFlowsFromFiles({\n      files,\n    });\n  };\n\n  const uploadFlow = async ({\n    files,\n    isComponent,\n    position,\n  }: {\n    files?: File[];\n    isComponent?: boolean;\n    position?: { x: number; y: number };\n  }): Promise<void> => {\n    try {\n      const flows = await getFlowsToUpload({ files });\n      for (const flow of flows) {","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/langflow-ai/langflow/blob/976ec789d2886a86de109c044d089d68e96c9a35/src/frontend/src/hooks/flows/use-upload-flow.ts#L22-L58","documentation":"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).","triggerScenarios":"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.","commonSituations":"OAuth settings saved without host/port fields; auth settings edited directly in the DB; version change that renamed the keys.","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."],"exampleFix":"// before\nproject_sse_url = await get_composer_sse_url(project)\n// after\nauth_config = await _get_mcp_composer_auth_config(project)\nif not auth_config.get(\"oauth_host\") or not auth_config.get(\"oauth_port\"):\n    raise HTTPException(status_code=400, detail=\"Set OAuth host and port before requesting the composer SSE URL\")\nproject_sse_url = await get_composer_sse_url(project)","handlingStrategy":"validation","validationCode":"auth_config = project.auth_settings or {}\nmissing = [k for k in (\"oauth_host\", \"oauth_port\") if not auth_config.get(k)]\nif missing:\n    raise ValueError(f\"auth settings missing: {missing}; complete them before requesting composer URLs\")","typeGuard":"def has_composer_endpoint(auth_settings: dict) -> bool:\n    return bool(auth_settings.get(\"oauth_host\")) and bool(auth_settings.get(\"oauth_port\"))","tryCatchPattern":"try:\n    sse_url = await get_composer_sse_url(project)\nexcept ValueError as e:\n    if \"OAuth host and port\" in str(e):\n        raise HTTPException(status_code=400, detail=str(e)) from e\n    raise","preventionTips":["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."],"tags":["mcp","mcp-composer","oauth","configuration"],"backgroundTag":null,"analyzedSha":"976ec789d2886a86de109c044d089d68e96c9a35","analyzedAt":"2026-08-14T18:23:12.227Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}