{"record":{"id":"6102eb93ead830b6","repo":"langflow-ai/langflow","slug":"str-e-6102eb","errorCode":null,"errorMessage":"str(e)","messagePattern":"str\\(e\\)","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"src/backend/base/langflow/api/v1/flows.py","lineNumber":668,"sourceCode":"    \"\"\"Upload flows from a JSON or ZIP file (upsert semantics for flows with stable IDs).\"\"\"\n    # Authorization is enforced per-flow below, after parsing — the per-flow\n    # check uses the actual workspace_id/folder_id each uploaded flow targets.\n    # A coarse pre-parse check here would over-reject (it would authorize the\n    # caller against ``domain=\"*\", obj=\"flow:*\"`` regardless of where the\n    # uploaded flows actually land).\n    if file is None:\n        raise HTTPException(status_code=400, detail=\"No file provided\")\n\n    contents = await file.read()\n\n    if not contents:\n        raise HTTPException(status_code=400, detail=\"The uploaded file is empty\")\n\n    if zipfile.is_zipfile(io.BytesIO(contents)):\n        try:\n            flows_data = await extract_flows_from_zip(contents)\n        except ValueError as e:\n            raise HTTPException(status_code=400, detail=str(e)) from e\n        if not flows_data:\n            raise HTTPException(status_code=400, detail=\"No valid flow JSON files found in the ZIP\")\n        data = {\"flows\": flows_data}\n    else:\n        try:\n            data = orjson.loads(contents)\n        except orjson.JSONDecodeError as e:\n            raise HTTPException(status_code=400, detail=f\"Invalid JSON file: {e}\") from e\n\n    # Normalise code fields: if exported with code-as-lines format, rejoin to\n    # strings before creating the Pydantic models so the DB always stores strings.\n    if not isinstance(data, dict):\n        raise HTTPException(\n            status_code=422,\n            detail=\"Invalid JSON: expected an object with 'flows' or a single flow object\",\n        )\n    try:\n        if \"flows\" in data:","sourceCodeStart":650,"sourceCodeEnd":686,"githubUrl":"https://github.com/langflow-ai/langflow/blob/976ec789d2886a86de109c044d089d68e96c9a35/src/backend/base/langflow/api/v1/flows.py#L650-L686","documentation":"Error \"str(e)\" thrown in langflow-ai/langflow.","triggerScenarios":"Occurs when reading or decoding the uploaded flow file raises an exception; the raw exception string is surfaced.","commonSituations":"See trigger scenarios.","solutions":["Inspect the logged exception for the root cause and validate the uploaded file contents."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"976ec789d2886a86de109c044d089d68e96c9a35","analyzedAt":"2026-08-14T18:23:12.227Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}