{"record":{"id":"d7b4decb23256e16","repo":"langflow-ai/langflow","slug":"invalid-json-expected-an-object-with-flows-or-a","errorCode":null,"errorMessage":"Invalid JSON: expected an object with 'flows' or a single flow object","messagePattern":"Invalid JSON: expected an object with 'flows' or a single flow object","errorType":"http","errorClass":"HTTPException","httpStatus":422,"severity":"error","filePath":"src/backend/base/langflow/api/v1/flows.py","lineNumber":681,"sourceCode":"\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:\n            if not isinstance(data[\"flows\"], list):\n                raise HTTPException(\n                    status_code=422,\n                    detail=\"Invalid JSON: 'flows' must be a list of flow objects\",\n                )\n            non_dict = [i for i, f in enumerate(data[\"flows\"]) if not isinstance(f, dict)]\n            if non_dict:\n                raise HTTPException(\n                    status_code=422,\n                    detail=f\"Invalid JSON: flows[{non_dict[0]}] is not an object\",\n                )\n            data = {**data, \"flows\": [normalize_code_for_import(f) for f in data[\"flows\"]]}\n            flow_list = FlowListCreate(**data)","sourceCodeStart":663,"sourceCodeEnd":699,"githubUrl":"https://github.com/langflow-ai/langflow/blob/976ec789d2886a86de109c044d089d68e96c9a35/src/backend/base/langflow/api/v1/flows.py#L663-L699","documentation":"Error \"Invalid JSON: expected an object with 'flows' or a single flow object\" thrown in langflow-ai/langflow.","triggerScenarios":"Occurs when the uploaded JSON is neither an object containing a 'flows' key nor a single flow object.","commonSituations":"See trigger scenarios.","solutions":["Upload a JSON object containing a 'flows' list, or a single flow object."],"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"}