langflow-ai/langflow · error · HTTPException

An internal error occurred while executing the flow.

Error message

An internal error occurred while executing the flow.

What it means

The non-streaming flow executor's catch-all: any exception during execution that is not HTTPException, CustomComponentValidationError, or ValueError becomes HTTP 500 with a generic detail. The real traceback is logged server-side only ('Flow execution error: {e}') so stack traces never leak to HTTP clients. It signals an unexpected internal failure — dependency errors, provider runtime failures, bugs in flow code.

Source

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

        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,
    api_key_var: str | None = None,
    is_disconnected: Callable[[], Coroutine[Any, Any, bool]] | None = None,
    cancel_event: asyncio.Event | None = None,

View on GitHub (pinned to 976ec789d2)

Solutions

  1. Inspect backend logs for the matching 'Flow execution error:' entry to identify the true exception and fix it at the source.
  2. Test the flow standalone in the Langflow canvas/run endpoint to isolate whether it is flow-specific.
  3. Add/verify error handling inside the flow's components so expected external failures raise handled errors instead of bare exceptions.
  4. Retry once — transient provider/network failures can surface here — but fix the root cause if it repeats deterministically.
Defensive patterns

Strategy: retry

Try / catch

for attempt in range(2):
    try:
        return await execute_flow(name)
    except HTTPException as e:
        if e.status_code == 500 and attempt == 0 and is_possibly_transient(e):
            await asyncio.sleep(1); continue
        raise

Prevention

When it happens

Trigger: Any unclassified exception during load_graph_for_execution, graph.prepare(), or get_default_coordinator().stream() for POST /api/v1/agentic/execute/{flow_name} or /assist — e.g. a provider SDK raising RuntimeError, KeyError inside a component, network failure to the model API.

Common situations: Model provider API returning an unexpected error/shape; a component raising an arbitrary exception type at runtime; missing optional dependency for a component used in the flow; transient network issues to external APIs.

Related errors


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