langflow-ai/langflow · error · CustomComponentValidationError

{e}

Error message

{e}

What it means

This is the non-streaming flow executor's 400 branch: a CustomComponentValidationError escaping graph loading/preparation is converted to HTTPException(400, detail=str(e)) so the caller sees the actual validation message (class name extraction, I/O overlap, reserved output name, etc.). The detail is the raw validator message, safe to display to the author of the flow.

Source

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

        if global_variables:
            if "request_variables" not in graph.context:
                graph.context["request_variables"] = {}
            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,

View on GitHub (pinned to 976ec789d2)

Solutions

  1. Read detail in the 400 response — it is the specific validator message; fix the reported issue in the component code.
  2. For overlapping/reserved-name errors rename inputs/outputs per the message; for missing return statements add 'return <value>' to each output method.
  3. Run the flow's component code through the local validator (langflow.agentic.helpers.validation) before deploying to the flows directory.
  4. For generic ValueError/other exceptions the endpoint returns 500 instead — check server logs (logger.error 'Flow execution error') for the underlying cause.
Defensive patterns

Strategy: try-catch

Try / catch

try:
    result = await execute_flow(name, input_value)
except HTTPException as e:
    if e.status_code == 400:
        show_author_error(e.detail)  # validator message, safe to display
    else:
        raise

Prevention

When it happens

Trigger: POST /api/v1/agentic/execute/{flow_name} (or /assist) where the named flow embeds a custom component whose code fails validate_custom_component_code during load_graph_for_execution; the ValueError from validation is caught as CustomComponentValidationError and re-raised as 400.

Common situations: Editing a .py flow file and introducing one of the validator failures (no class, overlapping names, reserved 'tool' output name, output method without return); LLM-rewritten components that drift from the required structure.

Related errors


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