From 18be4f0eafa02c9600eab02280d985e3bde8886d Mon Sep 17 00:00:00 2001 From: Swapna Lekkala Date: Thu, 13 Nov 2025 10:26:32 -0800 Subject: [PATCH] fix: Propagate the runtime error message to user --- src/llama_stack/core/server/server.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/llama_stack/core/server/server.py b/src/llama_stack/core/server/server.py index 0d3513980..114be3d8d 100644 --- a/src/llama_stack/core/server/server.py +++ b/src/llama_stack/core/server/server.py @@ -129,6 +129,9 @@ def translate_exception(exc: Exception) -> HTTPException | RequestValidationErro return HTTPException(status_code=httpx.codes.NOT_IMPLEMENTED, detail=f"Not implemented: {str(exc)}") elif isinstance(exc, AuthenticationRequiredError): return HTTPException(status_code=httpx.codes.UNAUTHORIZED, detail=f"Authentication required: {str(exc)}") + elif isinstance(exc, RuntimeError): + # Preserve the actual RuntimeError message for diagnosability + return HTTPException(status_code=httpx.codes.INTERNAL_SERVER_ERROR, detail=str(exc)) elif hasattr(exc, "status_code") and isinstance(getattr(exc, "status_code", None), int): # Handle provider SDK exceptions (e.g., OpenAI's APIStatusError and subclasses) # These include AuthenticationError (401), PermissionDeniedError (403), etc.