langflow-ai/langflow · error · HTTPException

parse_exception(exc)

Error message

parse_exception(exc)

What it means

Raised as HTTP 500 for any non-CustomComponentValidationError exception while building a single vertex. The detail is produced by parse_exception(exc), Langflow's helper that unwraps nested exception chains to present the most specific root-cause message instead of a generic outer traceback.

Source

Thrown at src/backend/base/langflow/api/v1/chat.py:617

            ),
        )
    except Exception as exc:
        background_tasks.add_task(
            telemetry_service.log_package_component,
            ComponentPayload(
                component_name=vertex_id.split("-")[0],
                component_id=vertex_id,
                component_seconds=int(time.perf_counter() - start_time),
                component_success=False,
                component_error_message=str(exc),
                component_run_id=run_id if "run_id" in locals() else None,
            ),
        )
        if isinstance(exc, CustomComponentValidationError):
            raise HTTPException(status_code=400, detail=str(exc)) from exc
        await logger.aexception("Error building Component")
        message = parse_exception(exc)
        raise HTTPException(status_code=500, detail=message) from exc

    return build_response


async def _stream_vertex(flow_id: str, vertex_id: str, chat_service: ChatService):
    graph = None
    try:
        try:
            cache = await chat_service.get_cache(flow_id)
        except Exception as exc:  # noqa: BLE001
            await logger.aexception("Error building Component")
            yield str(StreamData(event="error", data={"error": str(exc)}))
            return

        if isinstance(cache, CacheMiss):
            # If there's no cache
            msg = f"No cache found for {flow_id}."
            await logger.aerror(msg)

View on GitHub (pinned to 976ec789d2)

Solutions

  1. Read the parse_exception detail — it surfaces the root cause (e.g. '401 Invalid API key'), not just 'Error building Component'.
  2. Fix the root cause in the component's configuration (credentials, model name, endpoint URL) or its input wiring.
  3. Check the server log for the full aexception traceback if the parsed message is insufficient.
  4. Re-run the vertex build after fixing; for transient provider errors, retry with backoff.
Defensive patterns

Strategy: try-catch

Validate before calling

# Preflight external credentials the vertex depends on
if not os.environ.get("OPENAI_API_KEY"):
    raise ConfigError("Vertex requires OPENAI_API_KEY")

Try / catch

try:
    res = await client.post(vertex_url)
except httpx.HTTPStatusError as e:
    if e.response.status_code == 500:
        detail = e.response.json()["detail"]  # parse_exception root cause
        if "401" in detail or "api key" in detail.lower():
            raise CredentialsError(detail) from e
        raise VertexBuildError(detail) from e
    raise

Prevention

When it happens

Trigger: POST /build/{flow_id}/vertices/{vertex_id} where the component's build/run raises a runtime error: API auth failure, network timeout to an LLM provider, malformed input data, or a bug in component logic.

Common situations: Expired or wrong API keys configured in the component; provider rate limits; vertex receiving inputs of the wrong shape from an upstream node; transient network failures to external services.

Related errors


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