langflow-ai/langflow · error · HTTPException

parse_exception(exc)

Error message

parse_exception(exc)

What it means

Raised as HTTP 500 after a vertex (component) build fails during a flow run. The handler logs the exception via logger.aexception('Error building Component'), converts it with parse_exception(exc) — which unwraps nested exception chains to find the most informative message — and returns that message as the 500 detail. Telemetry also records the failure with component_error_message=str(exc).

Source

Thrown at src/backend/base/langflow/api/build.py:795

            if "vertex" in locals():
                # Extract and send component input telemetry even on error (separate payload)
                _log_component_input_telemetry(vertex, vertex_id, graph.run_id, background_tasks, telemetry_service)

            # Send component execution telemetry (error case)
            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=graph.run_id,
                ),
            )
            await logger.aexception("Error building Component")
            message = parse_exception(exc)
            raise HTTPException(status_code=500, detail=message) from exc

        return build_response

    async def build_vertices(
        vertex_id: str,
        graph: Graph,
        event_manager: EventManager,
        vertex_timedeltas: list[float],
    ) -> None:
        """Build vertices and handle their events.

        Args:
            vertex_id: The ID of the vertex to build
            graph: The graph instance
            event_manager: Manager for handling events
            vertex_timedeltas: Shared list to accumulate each vertex's timedelta
        """
        # Why: the background path never enters Graph.process(), so the pause boundary must live in this driver.

View on GitHub (pinned to 976ec789d2)

Solutions

  1. Read the 500 detail: parse_exception surfaces the innermost meaningful message (often the provider SDK error)
  2. Check the component identified by vertex_id (first telemetry field is vertex_id.split('-')[0]) in the UI
  3. Test that component in isolation with the same inputs
  4. For API-key/credential errors, re-enter the credentials in the component settings
  5. For custom components, add explicit input validation so errors surface earlier

Example fix

# before
from langflow.custom import Component
class MyComp(Component):
    def run(self) -> Message:
        return Message(text=self.inputs['x'].lower())  # KeyError -> 500
# after
from langflow.custom import Component
from langflow.io import MessageTextInput
from langflow.schema.message import Message
class MyComp(Component):
    inputs = [MessageTextInput(name='x')]
    def run(self) -> Message:
        if not self.x:
            self.status = 'x is required'
            return Message(text='')
        return Message(text=self.x.lower())
Defensive patterns

Strategy: try-catch

Try / catch

try { await runVertex(vertexId) } catch (e) { const msg = e.response?.data?.detail; // parse_exception output: innermost cause
  if (/api key|401|auth/i.test(msg)) refreshCredentials(vertexId); else logAndIsolate(vertexId, msg); }

Prevention

When it happens

Trigger: A single component's build()/run raising: invalid API key, malformed LLM response, bad input types, a custom component bug, a dependency import error inside the component.

Common situations: Flows that validate at save time but fail at run time (missing secrets, quota errors), custom components with runtime bugs, upstream SDK breaking changes after upgrading langflow.

Related errors


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