{"record":{"id":"ea0deaefaeddc080","repo":"langflow-ai/langflow","slug":"error-building-component","errorCode":null,"errorMessage":"Error building Component","messagePattern":"Error building Component","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"src/backend/base/langflow/api/v1/chat.py","lineNumber":768,"sourceCode":"        flow = (await session.exec(stmt)).first()\n    if not flow:\n        raise HTTPException(status_code=404, detail=f\"Flow with id {flow_id} not found\")\n    await ensure_flow_permission(\n        current_user,\n        FlowAction.EXECUTE,\n        flow_id=flow_id,\n        flow_user_id=flow.user_id,\n        workspace_id=flow.workspace_id,\n        folder_id=flow.folder_id,\n    )\n\n    try:\n        return StreamingResponse(\n            _stream_vertex(str(flow_id), vertex_id, get_chat_service()),\n            media_type=\"text/event-stream\",\n        )\n    except Exception as exc:\n        raise HTTPException(status_code=500, detail=\"Error building Component\") from exc\n\n\nasync def build_flow_and_stream(flow_id, inputs, background_tasks, current_user):\n    queue_service = get_queue_service()\n    build_response = await build_flow(\n        flow_id=flow_id,\n        inputs=inputs,\n        background_tasks=background_tasks,\n        current_user=current_user,\n        queue_service=queue_service,\n        event_delivery=EventDeliveryType.STREAMING,\n    )\n    job_id = build_response[\"job_id\"]\n    return await get_flow_events_response(\n        job_id=job_id,\n        queue_service=queue_service,\n        event_delivery=EventDeliveryType.STREAMING,\n    )","sourceCodeStart":750,"sourceCodeEnd":786,"githubUrl":"https://github.com/langflow-ai/langflow/blob/976ec789d2886a86de109c044d089d68e96c9a35/src/backend/base/langflow/api/v1/chat.py#L750-L786","documentation":"Raised as HTTP 500 with the static detail 'Error building Component' when constructing the StreamingResponse around _stream_vertex raises synchronously (before streaming begins). The static message is deliberate: at this point no component error context is available, and the real cause is logged via the exception chain (`from exc`) and server logs.","triggerScenarios":"Calling the stream-vertex endpoint when StreamingResponse(...) setup fails — e.g. the generator object cannot be created because chat service state is broken, or an exception escapes _stream_vertex's outer generator frame immediately.","commonSituations":"Server-side misconfiguration of the chat service singleton; rare internal-state corruption after cache invalidation; middleware that inspects the response body of a streaming response and fails.","solutions":["Check the server log for the chained `from exc` traceback — the detail string will not tell you the cause.","Retry after re-building the flow (POST /build/{flow_id}) to reset chat service cache state.","If reproducible, capture the traceback and report it upstream; the static message hides the root cause from the client.","Verify no custom middleware interferes with text/event-stream responses."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    return StreamingResponse(_stream_vertex(...), media_type=\"text/event-stream\")\nexcept Exception as exc:\n    logger.exception(\"Error building Component\")\n    raise HTTPException(status_code=500, detail=\"Error building Component\") from exc","preventionTips":["Re-build the flow (full build) to reset chat-service cache state, then retry the stream.","Keep SSE responses free of body-inspecting middleware.","Escalate to server logs: the client-visible detail never contains the cause."],"tags":["langflow","streaming","http-500","sse"],"backgroundTag":null,"analyzedSha":"976ec789d2886a86de109c044d089d68e96c9a35","analyzedAt":"2026-08-14T18:23:12.227Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}