{"record":{"id":"64eb8601e046d7fc","repo":"langflow-ai/langflow","slug":"parse-exception-exc","errorCode":null,"errorMessage":"parse_exception(exc)","messagePattern":"parse_exception\\(exc\\)","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"src/backend/base/langflow/api/build.py","lineNumber":795,"sourceCode":"            if \"vertex\" in locals():\n                # Extract and send component input telemetry even on error (separate payload)\n                _log_component_input_telemetry(vertex, vertex_id, graph.run_id, background_tasks, telemetry_service)\n\n            # Send component execution telemetry (error case)\n            background_tasks.add_task(\n                telemetry_service.log_package_component,\n                ComponentPayload(\n                    component_name=vertex_id.split(\"-\")[0],\n                    component_id=vertex_id,\n                    component_seconds=int(time.perf_counter() - start_time),\n                    component_success=False,\n                    component_error_message=str(exc),\n                    component_run_id=graph.run_id,\n                ),\n            )\n            await logger.aexception(\"Error building Component\")\n            message = parse_exception(exc)\n            raise HTTPException(status_code=500, detail=message) from exc\n\n        return build_response\n\n    async def build_vertices(\n        vertex_id: str,\n        graph: Graph,\n        event_manager: EventManager,\n        vertex_timedeltas: list[float],\n    ) -> None:\n        \"\"\"Build vertices and handle their events.\n\n        Args:\n            vertex_id: The ID of the vertex to build\n            graph: The graph instance\n            event_manager: Manager for handling events\n            vertex_timedeltas: Shared list to accumulate each vertex's timedelta\n        \"\"\"\n        # Why: the background path never enters Graph.process(), so the pause boundary must live in this driver.","sourceCodeStart":777,"sourceCodeEnd":813,"githubUrl":"https://github.com/langflow-ai/langflow/blob/976ec789d2886a86de109c044d089d68e96c9a35/src/backend/base/langflow/api/build.py#L777-L813","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the 500 detail: parse_exception surfaces the innermost meaningful message (often the provider SDK error)","Check the component identified by vertex_id (first telemetry field is vertex_id.split('-')[0]) in the UI","Test that component in isolation with the same inputs","For API-key/credential errors, re-enter the credentials in the component settings","For custom components, add explicit input validation so errors surface earlier"],"exampleFix":"# before\nfrom langflow.custom import Component\nclass MyComp(Component):\n    def run(self) -> Message:\n        return Message(text=self.inputs['x'].lower())  # KeyError -> 500\n# after\nfrom langflow.custom import Component\nfrom langflow.io import MessageTextInput\nfrom langflow.schema.message import Message\nclass MyComp(Component):\n    inputs = [MessageTextInput(name='x')]\n    def run(self) -> Message:\n        if not self.x:\n            self.status = 'x is required'\n            return Message(text='')\n        return Message(text=self.x.lower())","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { await runVertex(vertexId) } catch (e) { const msg = e.response?.data?.detail; // parse_exception output: innermost cause\n  if (/api key|401|auth/i.test(msg)) refreshCredentials(vertexId); else logAndIsolate(vertexId, msg); }","preventionTips":["Add input validation and clear error messages inside custom components","Dry-run components standalone before wiring them into large flows","Store credentials via langflow variable/secret handling rather than literals"],"tags":["component","build","http-500","runtime-error"],"backgroundTag":null,"analyzedSha":"976ec789d2886a86de109c044d089d68e96c9a35","analyzedAt":"2026-08-14T18:23:12.227Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}