langflow-ai/langflow · error · HTTPException

An error occurred while executing the flow.

Error message

An error occurred while executing the flow.

What it means

The non-streaming flow executor maps any ValueError raised during graph load/prepare/run (that is not a CustomComponentValidationError) to a generic HTTP 500. The real exception text is logged server-side ('Flow execution error: {e}') but deliberately withheld from the client. ValueErrors here typically come from graph construction, missing components, or invalid flow definitions.

Source

Thrown at src/backend/base/langflow/agentic/services/flow_executor.py:148

            graph.context["request_variables"].update(global_variables)

        flow_id = (global_variables or {}).get("FLOW_ID")
        if flow_id:
            graph.flow_id = flow_id
        graph.flow_name = graph.flow_name or flow_filename

        graph.prepare()
        inputs = InputValueRequest(input_value=input_value) if input_value else None

        results = [payload async for payload in get_default_coordinator().stream(graph, initial_inputs=inputs)]
        flow_result = extract_structured_result(results)
    except HTTPException:
        raise
    except CustomComponentValidationError as e:
        raise HTTPException(status_code=400, detail=str(e)) from e
    except ValueError as e:
        logger.error(f"Flow execution error: {e}")
        raise HTTPException(status_code=500, detail="An error occurred while executing the flow.") from e
    except Exception as e:
        logger.error(f"Flow execution error: {e}")
        raise HTTPException(status_code=500, detail="An internal error occurred while executing the flow.") from e
    else:
        if isinstance(flow_result, dict):
            flow_result["_metrics"] = extract_graph_token_usage(graph)
        return flow_result


async def execute_flow_file_streaming(
    flow_filename: str,
    input_value: str | None = None,
    global_variables: dict[str, str] | None = None,
    *,
    user_id: str | None = None,
    session_id: str | None = None,
    provider: str | None = None,
    model_name: str | None = None,

View on GitHub (pinned to 976ec789d2)

Solutions

  1. Check the backend logs for the 'Flow execution error:' line — it contains the actual ValueError message; fix that root cause.
  2. Open the flow in the Langflow editor and re-save to revalidate components; replace components flagged as missing.
  3. Regenerate the .py/.json flow file from a working canvas export rather than hand-editing.
  4. Ensure server and flow authoring environment run the same Langflow version.
Defensive patterns

Strategy: fallback

Try / catch

except HTTPException as e:
    if e.status_code == 500 and 'executing the flow' in e.detail:
        log_correlation_id(); alert_operator('check server logs: Flow execution error')
        return friendly_error_page()

Prevention

When it happens

Trigger: POST /api/v1/agentic/execute/{flow_name} where loading the flow file raises ValueError — e.g. flow JSON/Python references an unknown component type, a malformed graph, get_graph() returning something invalid — during load_graph_for_execution, graph.prepare(), or coordinator stream.

Common situations: Flow file references a component removed/renamed in an upgrade; flow built on a newer Langflow version than the server; malformed hand-edited flow JSON producing invalid vertex/edge data.

Related errors


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