llama-stack-mirror/llama_stack
Ashwin Bharambe 359d3eeff2 fix(inference): propagate 401 errors
Remote provider authentication errors (401/403) were being converted to 500 Internal Server Error, hiding the real cause from users.

Now checks if exceptions have a status_code attribute and preserves it. This fixes authentication error handling for all remote inference providers using OpenAI SDK (groq, openai, together, fireworks, etc.) and similar provider SDKs.

Before:
- HTTP 500: "Internal server error: An unexpected error occurred."

After:
- HTTP 401: "Error code: 401 - Invalid API Key"

Fixes #2990

Test Plan:
1. Build stack: llama stack build --image-type venv --providers inference=remote::groq
2. Start stack: llama stack run
3. Send request with invalid API key via x-llamastack-provider-data header
4. Verify response is 401 with provider error message (not 500)
5. Repeat for openai, together, fireworks providers
2025-10-09 17:47:41 -07:00
..
apis docs: API docstrings cleanup for better documentation rendering (#3661) 2025-10-06 10:46:33 -07:00
cli chore!: remove --env from llama stack run (#3711) 2025-10-07 20:58:15 -07:00
core fix(inference): propagate 401 errors 2025-10-09 17:47:41 -07:00
distributions fix: Update watsonx.ai provider to use LiteLLM mixin and list all models (#3674) 2025-10-08 07:29:43 -04:00
models chore: remove dead code (#3729) 2025-10-07 20:26:02 -07:00
providers feat(tests): make inference_recorder into api_recorder (include tool_invoke) (#3403) 2025-10-09 14:27:51 -07:00
strong_typing feat: Add OpenAI Conversations API (#3429) 2025-10-03 08:47:18 -07:00
testing fix(testing): improve api_recorder error messages for missing recordings (#3760) 2025-10-09 15:04:16 -07:00
ui chore(ui-deps): bump react-dom and @types/react-dom in /llama_stack/ui (#3693) 2025-10-06 00:02:31 -04:00
__init__.py chore(rename): move llama_stack.distribution to llama_stack.core (#2975) 2025-07-30 23:30:53 -07:00
env.py refactor(test): move tools, evals, datasetio, scoring and post training tests (#1401) 2025-03-04 14:53:47 -08:00
log.py fix(tests): ensure test isolation in server mode (#3737) 2025-10-08 12:03:36 -07:00
schema_utils.py feat(api): add extra_body parameter support with shields example (#3670) 2025-10-03 13:25:09 -07:00