langflow-ai/langflow · error · HTTPException

Invalid JSON: flows[{non_dict[0]}] is not an object

Error message

Invalid JSON: flows[{non_dict[0]}] is not an object

What it means

Error "Invalid JSON: flows[{non_dict[0]}] is not an object" thrown in langflow-ai/langflow.

Source

Thrown at src/backend/base/langflow/api/v1/flows.py:694

            raise HTTPException(status_code=400, detail=f"Invalid JSON file: {e}") from e

    # Normalise code fields: if exported with code-as-lines format, rejoin to
    # strings before creating the Pydantic models so the DB always stores strings.
    if not isinstance(data, dict):
        raise HTTPException(
            status_code=422,
            detail="Invalid JSON: expected an object with 'flows' or a single flow object",
        )
    try:
        if "flows" in data:
            if not isinstance(data["flows"], list):
                raise HTTPException(
                    status_code=422,
                    detail="Invalid JSON: 'flows' must be a list of flow objects",
                )
            non_dict = [i for i, f in enumerate(data["flows"]) if not isinstance(f, dict)]
            if non_dict:
                raise HTTPException(
                    status_code=422,
                    detail=f"Invalid JSON: flows[{non_dict[0]}] is not an object",
                )
            data = {**data, "flows": [normalize_code_for_import(f) for f in data["flows"]]}
            flow_list = FlowListCreate(**data)
        else:
            flow_list = FlowListCreate(flows=[FlowCreate(**normalize_code_for_import(data))])
    except HTTPException:
        raise
    except ValidationError as e:
        raise HTTPException(status_code=422, detail=str(e)) from e

    # TODO: Full-version import is planned as a follow-up feature.
    # When implemented, extract raw flow dicts here to read embedded "version"
    # arrays and create FlowVersion entries for each imported flow.

    # Per-flow CREATE check on the effective destination. _upsert_flow_list lets
    # the query `folder_id` override each flow's `folder_id`, but it preserves

View on GitHub (pinned to 976ec789d2)

Solutions

  1. Ensure every entry in the 'flows' array is a JSON object representing a flow.

When it happens

Trigger: Occurs when an element of the 'flows' list in the uploaded JSON is not a JSON object.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of langflow-ai/langflow@976ec789d2 (2026-08-14). Data as JSON: /api/errors/0c9d8dbe50d8d210. Report an issue: GitHub.