From 7fb9d76416751a55b6c0ac8771c93e700df29ed5 Mon Sep 17 00:00:00 2001 From: Pranshu Srivastava Date: Thu, 29 Jan 2026 11:54:47 +0530 Subject: [PATCH] endpoints: Surface failed event errors in logs I wasn't able to make out what was wrong while running LCS, as the unexpected error message wasn't much to go on with. Upon surfacing the actual error, I noticed that the failed event fired since I had hit my token limit, which I believe is useful enough information to be surfaced. I understand if this wasn't done earlier to prevent sensitive data leakage, in which case, I'll close this, or add a case to surface only when token limit is hit, although that may be tricky since different LLMs report that in different ways. Signed-off-by: Pranshu Srivastava --- src/app/endpoints/streaming_query_v2.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app/endpoints/streaming_query_v2.py b/src/app/endpoints/streaming_query_v2.py index bdeccb0e7..e6f1e884c 100644 --- a/src/app/endpoints/streaming_query_v2.py +++ b/src/app/endpoints/streaming_query_v2.py @@ -265,7 +265,9 @@ async def response_generator( # pylint: disable=too-many-branches,too-many-stat else "An unexpected error occurred while processing the request." ) error_response = InternalServerErrorResponse.query_failed(error_message) - logger.error("Error while obtaining answer for user question") + logger.error( + "Error while obtaining answer for user question: %s", error_message + ) yield format_stream_data( {"event": "error", "data": {**error_response.detail.model_dump()}} )