Skip to content

fix(proxy): stop labelling management and health rejections as auth failures - #47778

Closed
mateo-berri wants to merge 4 commits into
mainfrom
litellm_management_error_types_main
Closed

mateo-berri wants to merge 4 commits into
mainfrom
litellm_management_error_types_main

Conversation

@mateo-berri

@mateo-berri mateo-berri commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Management and health routes like /team/info, /user/update, /key/update and /model/delete answer every rejection with type: auth_error, even a 404 for a team that does not exist or a 400 for a bad budget_duration. A script that branches on type then goes off re-minting a key that was never the problem

This makes the 11 catch-all handlers on those routes name the error by the status they already answer with (invalid_request_error, internal_server_error, permission_error) and drops the made-up Authentication Error, prefix from the message. Real login, SSO and key failures keep the type they had. Replaces #39558, which was stacked on two stale PRs and could not land on main by itself

Original

TLDR

Problem this solves:

  • Management routes label every rejection type: auth_error
  • /team/info says auth_error for a team that does not exist
  • /user/update says auth_error for a bad budget_duration
  • Clients branching on type retry the key, not the field

How it solves it:

  • The catch-all handlers read the type off the exception
  • Every status each handler answered with is kept
  • A deliberate ProxyException passes through with its own type
  • Real auth and SSO sites keep auth_error, untouched

User Flow

Before: an admin scripting the management API is told their credentials failed when the request body was the problem

  1. They send POST https://litellm-domain/user/update with {"user_id":"u1","budget_duration":"not-a-duration"} and a valid admin key
  2. It comes back 400 with "type":"auth_error" and a message starting Authentication Error,
  3. GET https://litellm-domain/team/info?team_id=no-such-team comes back 404 with "type":"auth_error" too
  4. Their script sees an auth failure and re-mints a key that was never the problem

After: the same requests are labelled for what went wrong

  1. They send the same POST https://litellm-domain/user/update
  2. It comes back 400 with "type":"invalid_request_error" and the bare validation message
  3. GET https://litellm-domain/team/info?team_id=no-such-team comes back 404 with "type":"invalid_request_error"
  4. Their script surfaces the message, and a bad key still gets 401 with its own auth type

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have added meaningful tests
  • The handful of test files covering my change pass locally, e.g. uv run pytest tests/unit/<your_test_file>.py -v. Leave the suites (make test-unit-*, make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more
  • My PR passes all required CI/CD checks (e.g., lint, schema.d.ts sync check, etc.)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • Every automated review on my PR's latest commit has finished, and I have addressed or replied to each of its findings before requesting a maintainer review

Delays in PR merge?

If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).

Screenshots / Proof of Fix

Case Before After
1. Sanity, a real Anthropic call 200 200
2. GET /team/info, team that does not exist 404 auth_error 404 invalid_request_error
3. POST /user/update, bad budget_duration 400 auth_error 400 invalid_request_error
4. POST /key/update, bad budget_duration 400 auth_error 400 invalid_request_error
5. POST /organization/member_add, org that does not exist 404 auth_error 404 invalid_request_error
6. POST /model/delete, id that does not exist 400 auth_error 400 invalid_request_error
7. POST /model/update, id that does not exist 400 auth_error 400 invalid_request_error
8. POST /model/new, id that already exists 500 auth_error 500 internal_server_error
9. GET /health/services, unknown service 400 auth_error 400 invalid_request_error
10. POST /queue/chat/completions, no priority 400 invalid_request_error 400 invalid_request_error
11. POST /queue/chat/completions, unknown model 400 invalid_request_error 400 invalid_request_error
12. POST /config/update, non-string callback 400 auth_error 400 invalid_request_error
13. GET /get/config/callbacks, after storing a scalar callback 200 200
14. Control, unknown key 401 token_not_found_in_db 401 token_not_found_in_db
15. Control, wrong UI password 401 auth_error 401 auth_error
Shared setup

Two live proxies on the GCE QA box, same config, same cases, same order, differing only in the commit they booted from. Each ran two uvicorn workers against its own Postgres database, with real Anthropic credentials, and every call uses a valid admin key unless the case says otherwise

model_list:
  - model_name: claude-haiku-5-5
    litellm_params:
      model: anthropic/claude-haiku-5-5
      api_key: os.environ/ANTHROPIC_API_KEY

general_settings:
  store_model_in_db: true
python litellm/proxy/proxy_cli.py --config config.yaml --port <port> --num_workers 2 --use_prisma_db_push

Before (11b5d1a)

2. GET /team/info, team that does not exist

  1. Run:
curl -sS "$PROXY/team/info?team_id=no-such-team-qa" -H "Authorization: Bearer $LITELLM_MASTER_KEY"
  1. Observed, HTTP 404:
{"error":{"message":"{'message': 'Team not found, passed team id: no-such-team-qa.'}","type":"auth_error","param":"None","code":"404"}}
The other 14 cases

1. Sanity, a real Anthropic call

  1. Run:
curl -sS -X POST "$PROXY/v1/chat/completions" -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' \
  -d '{"model":"claude-haiku-5-5","messages":[{"role":"user","content":"say slp-qa-ok and nothing else"}],"max_tokens":16}'
  1. Observed, HTTP 200:
{"id":"chatcmpl-283a9b37-eefc-4c36-8b4e-652a140c6873","created":1792557167,"model":"claude-haiku-5-5","object":"chat.completion","choices":[{"finish_reason":"stop","index":0,"message":{"content":"slp-qa-ok","role":"assistant","provider_specific_fields":{"citations":null,"thinking_blocks":null}}}],"usage":{"completion_tokens":10,"prompt_tokens":22,"total_tokens":32,"completion_tokens_details":{"reasoning_tokens":0,"text_tokens":10},"prompt_tokens_details":{"cached_tokens":0,"text_tokens":22,"cache_write_tokens":0,"cache_creation_tokens":0,"cache_creation_token_details":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0}},"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"inference_geo":"global","speed":"standard","service_tier":"standard"}}

3. POST /user/update, bad budget_duration

  1. Run:
curl -sS -X POST "$PROXY/user/update" -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' \
  -d '{"user_id":"u-qa-repro","budget_duration":"not-a-duration"}'
  1. Observed, HTTP 400:
{"error":{"message":"{'error': \"Invalid budget_duration 'not-a-duration'. Use a format like '1h', '24h', '7d', or '30d'.\"}","type":"auth_error","param":"None","code":"400"}}

4. POST /key/update, bad budget_duration

  1. Run:
KEY=$(curl -sS -X POST "$PROXY/key/generate" -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' -d '{}' | jq -r .key)
  1. Run:
curl -sS -X POST "$PROXY/key/update" -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' \
  -d "{\"key\":\"$KEY\",\"budget_duration\":\"not-a-duration\"}"
  1. Observed, HTTP 400:
{"error":{"message":"{'error': \"Invalid budget_duration 'not-a-duration'. Use a format like '1h', '24h', '7d', or '30d'.\"}","type":"auth_error","param":"None","code":"400"}}

5. POST /organization/member_add, org that does not exist

  1. Run:
curl -sS -X POST "$PROXY/organization/member_add" -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' \
  -d '{"organization_id":"no-such-org-qa","member":{"role":"internal_user","user_email":"qa@example.com"}}'
  1. Observed, HTTP 404:
{"error":{"message":"{'error': 'Organization not found for organization_id=no-such-org-qa'}","type":"auth_error","param":"None","code":"404"}}

6. POST /model/delete, id that does not exist

  1. Run:
curl -sS -X POST "$PROXY/model/delete" -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' -d '{"id":"no-such-model-qa"}'
  1. Observed, HTTP 400:
{"error":{"message":"{'error': 'Model with id=no-such-model-qa not found in db'}","type":"auth_error","param":"None","code":"400"}}

7. POST /model/update, id that does not exist

  1. Run:
curl -sS -X POST "$PROXY/model/update" -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' \
  -d '{"model_name":"qa-ghost","litellm_params":{"model":"anthropic/claude-haiku-5-5"},"model_info":{"id":"no-such-model-qa"}}'
  1. Observed, HTTP 400:
{"error":{"message":"Authentication Error, model not found","type":"auth_error","param":"None","code":"400"}}

8. POST /model/new, id that already exists

  1. Run:
curl -sS -X POST "$PROXY/model/new" -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' \
  -d '{"model_name":"qa-dup","litellm_params":{"model":"anthropic/claude-haiku-5-5"},"model_info":{"id":"qa-fixed-id"}}'
  1. Run the same command again, so the id already exists

  2. Observed, HTTP 500:

{"error":{"message":"{'error': 'Failed to add model to db. Check your server logs for more details.'}","type":"auth_error","param":"None","code":"500"}}

9. GET /health/services, unknown service

  1. Run:
curl -sS "$PROXY/health/services?service=not-a-service" -H "Authorization: Bearer $LITELLM_MASTER_KEY"
  1. Observed, HTTP 400:
{"error":{"message":"{'error': \"Service must be in list. Service=not-a-service not in ['agentops', 'anthropic_cache_control_hook', 'argilla', 'arize', 'arize_phoenix', 'aws_sqs', 'azure_sentinel', 'azure_storage', 'bitbucket', 'braintrust', 'clickhouse', 'cloudzero', 'compression_interception', 'custom_callback_api', 'datadog', 'datadog_llm_observability', 'datadog_metrics', 'deepeval', 'dotprompt', 'dynamic_rate_limiter', 'dynamic_rate_limiter_v3', 'email', 'focus', 'galileo', 'gcs_bucket', 'gcs_pubsub', 'generic_api', 'gitlab', 'humanloop', 'lago', 'langfuse', 'langfuse_otel', 'langsmith', 'langtrace', 'levo', 'litellm_agent', 'literalai', 'logfire', 'mavvrik', 'mlflow', 'ms_teams', 'newrelic', 'openmeter', 'opik', 'otel', 'pagerduty', 'pointfive', 'posthog', 'prometheus', 'resend_email', 's3_v2', 'sendgrid_email', 'signoz', 'slack', 'slack_budget_alerts', 'smtp_email', 'sqs', 'ternary', 'vantage', 'vector_store_pre_call_hook', 'weave_otel', 'webhook', 'zerobus']\"}","type":"auth_error","param":"None","code":"400"}}

10. POST /queue/chat/completions, no priority

  1. Run:
curl -sS -X POST "$PROXY/queue/chat/completions" -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' \
  -d '{"model":"claude-haiku-5-5","messages":[{"role":"user","content":"hi"}]}'
  1. Observed, HTTP 400:
{"error":{"message":"litellm.BadRequestError: priority is required to queue a request, send one or set router_settings.default_priority","type":"invalid_request_error","param":"priority","code":"400"}}

11. POST /queue/chat/completions, unknown model

  1. Run:
curl -sS -X POST "$PROXY/queue/chat/completions" -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' \
  -d '{"model":"no-such-model-qa","messages":[{"role":"user","content":"hi"}],"priority":0}'
  1. Observed, HTTP 400:
{"error":{"message":"litellm.BadRequestError: You passed in model=no-such-model-qa. There are no healthy deployments for this model\n\nLiteLLM: model group 'no-such-model-qa' failed with the error above. No fallback was attempted.","type":"invalid_request_error","param":null,"code":"400"}}

12. POST /config/update, non-string callback

  1. Run:
curl -sS -X POST "$PROXY/config/update" -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' \
  -d '{"litellm_settings":{"success_callback":[{"not":"a-string"}]}}'
  1. Observed, HTTP 400:
{"error":{"message":"Authentication Error, unhashable type: 'dict'","type":"auth_error","param":"None","code":"400"}}

13. GET /get/config/callbacks, after storing a scalar callback

  1. Run:
curl -sS -X POST "$PROXY/config/update" -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' -d '{"litellm_settings":{"success_callback":5}}'
  1. Run:
curl -sS "$PROXY/get/config/callbacks" -H "Authorization: Bearer $LITELLM_MASTER_KEY"
  1. Observed, HTTP 200:
{"status":"success","callbacks":[],"alerts":[{"name":"email","variables":{"SMTP_HOST":null,"SMTP_PORT":"587","SMTP_TLS":"True","SMTP_USERNAME":null,"SMTP_PASSWORD":null,"SMTP_SENDER_EMAIL":null,"TEST_EMAIL_ADDRESS":null,"EMAIL_LOGO_URL":null,"EMAIL_SUPPORT_CONTACT":null}},{"name":"ms_teams","variables":{"MS_TEAMS_WEBHOOK_URL":null}}],"active_alerting_destinations":[],"router_settings":{"routing_strategy_args":{},"routing_strategy":"simple-shuffle","allowed_fails":3,"cooldown_time":5,"num_retries":2,"timeout":6000.0,"retry_after":0,"fallbacks":null,"context_window_fallbacks":null,"model_group_retry_policy":{},"retry_policy":null,"model_group_alias":{},"enable_weighted_failover":false,"enable_mid_stream_fallback_continuation":false,"enable_tag_filtering":false,"tag_routing_prefix":"","fallback_on_unsupported_params":true,"routing_groups":[]},"available_callbacks":{"langfuse":{"litellm_callback_name":"langfuse","litellm_callback_params":["LANGFUSE_PUBLIC_KEY","LANGFUSE_SECRET_KEY","LANGFUSE_HOST"],"ui_callback_name":"Langfuse"},"otel":{"litellm_callback_name":"otel","litellm_callback_params":["OTEL_EXPORTER","OTEL_EXPORTER_OTLP_PROTOCOL","OTEL_ENDPOINT","OTEL_TRACES_ENDPOINT","OTEL_HEADERS"],"ui_callback_name":"OpenTelemetry"},"s3":{"litellm_callback_name":"s3","litellm_callback_params":["AWS_ACCESS_KEY_ID","AWS_SECRET_ACCESS_KEY","AWS_REGION_NAME","S3_LOG_PROMPTS_ONLY","S3_PARTITION_GRANULARITY"],"ui_callback_name":"s3 Bucket (AWS)"},"azure_sentinel":{"litellm_callback_name":"azure_sentinel","litellm_callback_params":["AZURE_SENTINEL_DCR_IMMUTABLE_ID","AZURE_SENTINEL_ENDPOINT","AZURE_SENTINEL_TENANT_ID","AZURE_SENTINEL_CLIENT_ID","AZURE_SENTINEL_CLIENT_SECRET","AZURE_SENTINEL_STREAM_NAME"],"ui_callback_name":"Azure Sentinel"},"openmeter":{"litellm_callback_name":"openmeter","litellm_callback_params":["OPENMETER_API_ENDPOINT","OPENMETER_API_KEY"],"ui_callback_name":"OpenMeter"},"custom_callback_api":{"litellm_callback_name":"custom_callback_api","litellm_callback_params":["GENERIC_LOGGER_ENDPOINT","GENERIC_LOGGER_HEADERS"],"ui_callback_name":"Custom Callback API"},"generic_api":{"litellm_callback_name":"generic_api","litellm_callback_params":["GENERIC_LOGGER_ENDPOINT","GENERIC_LOGGER_HEADERS"],"ui_callback_name":"Custom Callback API"},"datadog":{"litellm_callback_name":"datadog","litellm_callback_params":["DD_API_KEY","DD_SITE"],"ui_callback_name":"Datadog"},"braintrust":{"litellm_callback_name":"braintrust","litellm_callback_params":["BRAINTRUST_API_KEY","BRAINTRUST_API_BASE"],"ui_callback_name":"Braintrust"},"langsmith":{"litellm_callback_name":"langsmith","litellm_callback_params":["LANGSMITH_API_KEY","LANGSMITH_PROJECT","LANGSMITH_DEFAULT_RUN_NAME"],"ui_callback_name":"Langsmith"},"lago":{"litellm_callback_name":"lago","litellm_callback_params":["LAGO_API_BASE","LAGO_API_KEY","LAGO_API_EVENT_CODE","LAGO_API_CHARGE_BY"],"ui_callback_name":"Lago Billing"},"traceloop":{"litellm_callback_name":"traceloop","litellm_callback_params":["TRACELOOP_API_KEY"],"ui_callback_name":"Traceloop"},"galileo":{"litellm_callback_name":"galileo","litellm_callback_params":["GALILEO_API_KEY","GALILEO_PROJECT_ID","GALILEO_LOG_STREAM_ID","GALILEO_BASE_URL","GALILEO_USERNAME","GALILEO_PASSWORD"],"ui_callback_name":"Galileo"},"newrelic":{"litellm_callback_name":"newrelic","litellm_callback_params":["NEW_RELIC_AI_MONITORING_RECORD_CONTENT_ENABLED"],"ui_callback_name":"New Relic"},"pointfive":{"litellm_callback_name":"pointfive","litellm_callback_params":["POINTFIVE_API_KEY","POINTFIVE_API_URL"],"ui_callback_name":"PointFive"},"signoz":{"litellm_callback_name":"signoz","litellm_callback_params":["SIGNOZ_INGESTION_ENDPOINT","SIGNOZ_INGESTION_KEY"],"ui_callback_name":"SigNoz"},"zerobus":{"litellm_callback_name":"zerobus","litellm_callback_params":["ZEROBUS_WORKSPACE_URL","ZEROBUS_SERVER_ENDPOINT","ZEROBUS_CLIENT_ID","ZEROBUS_CLIENT_SECRET","ZEROBUS_TABLE_NAME"],"ui_callback_name":"Databricks Zerobus"}}}

14. Control, unknown key

  1. Run:
curl -sS "$PROXY/team/info?team_id=whatever" -H "Authorization: Bearer sk-not-a-real-key-qa"
  1. Observed, HTTP 401:
{"error":{"message":"Authentication Error, Invalid API key provided.","type":"token_not_found_in_db","param":"key","code":"401"}}

15. Control, wrong UI password

  1. Run:
curl -sS -X POST "$PROXY/login" -d 'username=admin&password=definitely-wrong-qa'
  1. Observed, HTTP 401:
{"error":{"message":"Invalid credentials used to access UI. Check 'UI_USERNAME' and 'UI_PASSWORD', or the password set for your user","type":"auth_error","param":"invalid_credentials","code":"401"}}

After (76a4aa8)

2. GET /team/info, team that does not exist

  1. Run:
curl -sS "$PROXY/team/info?team_id=no-such-team-qa" -H "Authorization: Bearer $LITELLM_MASTER_KEY"
  1. Observed, HTTP 404:
{"error":{"message":"{'message': 'Team not found, passed team id: no-such-team-qa.'}","type":"invalid_request_error","param":null,"code":"404"}}
The other 14 cases

1. Sanity, a real Anthropic call

  1. Run:
curl -sS -X POST "$PROXY/v1/chat/completions" -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' \
  -d '{"model":"claude-haiku-5-5","messages":[{"role":"user","content":"say slp-qa-ok and nothing else"}],"max_tokens":16}'
  1. Observed, HTTP 200:
{"id":"chatcmpl-a1b8a4c7-1bb5-439c-a3e1-8aa599f03623","created":1792557161,"model":"claude-haiku-5-5","object":"chat.completion","choices":[{"finish_reason":"stop","index":0,"message":{"content":"slp-qa-ok","role":"assistant","provider_specific_fields":{"citations":null,"thinking_blocks":null}}}],"usage":{"completion_tokens":10,"prompt_tokens":22,"total_tokens":32,"completion_tokens_details":{"reasoning_tokens":0,"text_tokens":10},"prompt_tokens_details":{"cached_tokens":0,"text_tokens":22,"cache_write_tokens":0,"cache_creation_tokens":0,"cache_creation_token_details":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0}},"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"inference_geo":"global","speed":"standard","service_tier":"standard"}}

3. POST /user/update, bad budget_duration

  1. Run:
curl -sS -X POST "$PROXY/user/update" -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' \
  -d '{"user_id":"u-qa-repro","budget_duration":"not-a-duration"}'
  1. Observed, HTTP 400:
{"error":{"message":"{'error': \"Invalid budget_duration 'not-a-duration'. Use a format like '1h', '24h', '7d', or '30d'.\"}","type":"invalid_request_error","param":null,"code":"400"}}

4. POST /key/update, bad budget_duration

  1. Run:
KEY=$(curl -sS -X POST "$PROXY/key/generate" -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' -d '{}' | jq -r .key)
  1. Run:
curl -sS -X POST "$PROXY/key/update" -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' \
  -d "{\"key\":\"$KEY\",\"budget_duration\":\"not-a-duration\"}"
  1. Observed, HTTP 400:
{"error":{"message":"{'error': \"Invalid budget_duration 'not-a-duration'. Use a format like '1h', '24h', '7d', or '30d'.\"}","type":"invalid_request_error","param":null,"code":"400"}}

5. POST /organization/member_add, org that does not exist

  1. Run:
curl -sS -X POST "$PROXY/organization/member_add" -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' \
  -d '{"organization_id":"no-such-org-qa","member":{"role":"internal_user","user_email":"qa@example.com"}}'
  1. Observed, HTTP 404:
{"error":{"message":"{'error': 'Organization not found for organization_id=no-such-org-qa'}","type":"invalid_request_error","param":null,"code":"404"}}

6. POST /model/delete, id that does not exist

  1. Run:
curl -sS -X POST "$PROXY/model/delete" -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' -d '{"id":"no-such-model-qa"}'
  1. Observed, HTTP 400:
{"error":{"message":"{'error': 'Model with id=no-such-model-qa not found in db'}","type":"invalid_request_error","param":null,"code":"400"}}

7. POST /model/update, id that does not exist

  1. Run:
curl -sS -X POST "$PROXY/model/update" -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' \
  -d '{"model_name":"qa-ghost","litellm_params":{"model":"anthropic/claude-haiku-5-5"},"model_info":{"id":"no-such-model-qa"}}'
  1. Observed, HTTP 400:
{"error":{"message":"model not found","type":"invalid_request_error","param":null,"code":"400"}}

8. POST /model/new, id that already exists

  1. Run:
curl -sS -X POST "$PROXY/model/new" -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' \
  -d '{"model_name":"qa-dup","litellm_params":{"model":"anthropic/claude-haiku-5-5"},"model_info":{"id":"qa-fixed-id"}}'
  1. Run the same command again, so the id already exists

  2. Observed, HTTP 500:

{"error":{"message":"{'error': 'Failed to add model to db. Check your server logs for more details.'}","type":"internal_server_error","param":null,"code":"500"}}

9. GET /health/services, unknown service

  1. Run:
curl -sS "$PROXY/health/services?service=not-a-service" -H "Authorization: Bearer $LITELLM_MASTER_KEY"
  1. Observed, HTTP 400:
{"error":{"message":"{'error': \"Service must be in list. Service=not-a-service not in ['agentops', 'anthropic_cache_control_hook', 'argilla', 'arize', 'arize_phoenix', 'aws_sqs', 'azure_sentinel', 'azure_storage', 'bitbucket', 'braintrust', 'clickhouse', 'cloudzero', 'compression_interception', 'custom_callback_api', 'datadog', 'datadog_llm_observability', 'datadog_metrics', 'deepeval', 'dotprompt', 'dynamic_rate_limiter', 'dynamic_rate_limiter_v3', 'email', 'focus', 'galileo', 'gcs_bucket', 'gcs_pubsub', 'generic_api', 'gitlab', 'humanloop', 'lago', 'langfuse', 'langfuse_otel', 'langsmith', 'langtrace', 'levo', 'litellm_agent', 'literalai', 'logfire', 'mavvrik', 'mlflow', 'ms_teams', 'newrelic', 'openmeter', 'opik', 'otel', 'pagerduty', 'pointfive', 'posthog', 'prometheus', 'resend_email', 's3_v2', 'sendgrid_email', 'signoz', 'slack', 'slack_budget_alerts', 'smtp_email', 'sqs', 'ternary', 'vantage', 'vector_store_pre_call_hook', 'weave_otel', 'webhook', 'zerobus']\"}","type":"invalid_request_error","param":null,"code":"400"}}

10. POST /queue/chat/completions, no priority

  1. Run:
curl -sS -X POST "$PROXY/queue/chat/completions" -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' \
  -d '{"model":"claude-haiku-5-5","messages":[{"role":"user","content":"hi"}]}'
  1. Observed, HTTP 400:
{"error":{"message":"litellm.BadRequestError: priority is required to queue a request, send one or set router_settings.default_priority","type":"invalid_request_error","param":"priority","code":"400"}}

11. POST /queue/chat/completions, unknown model

  1. Run:
curl -sS -X POST "$PROXY/queue/chat/completions" -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' \
  -d '{"model":"no-such-model-qa","messages":[{"role":"user","content":"hi"}],"priority":0}'
  1. Observed, HTTP 400:
{"error":{"message":"litellm.BadRequestError: You passed in model=no-such-model-qa. There are no healthy deployments for this model\n\nLiteLLM: model group 'no-such-model-qa' failed with the error above. No fallback was attempted.","type":"invalid_request_error","param":null,"code":"400"}}

12. POST /config/update, non-string callback

  1. Run:
curl -sS -X POST "$PROXY/config/update" -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' \
  -d '{"litellm_settings":{"success_callback":[{"not":"a-string"}]}}'
  1. Observed, HTTP 400:
{"error":{"message":"unhashable type: 'dict'","type":"invalid_request_error","param":null,"code":"400"}}

13. GET /get/config/callbacks, after storing a scalar callback

  1. Run:
curl -sS -X POST "$PROXY/config/update" -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' -d '{"litellm_settings":{"success_callback":5}}'
  1. Run:
curl -sS "$PROXY/get/config/callbacks" -H "Authorization: Bearer $LITELLM_MASTER_KEY"
  1. Observed, HTTP 200:
{"status":"success","callbacks":[],"alerts":[{"name":"email","variables":{"SMTP_HOST":null,"SMTP_PORT":"587","SMTP_TLS":"True","SMTP_USERNAME":null,"SMTP_PASSWORD":null,"SMTP_SENDER_EMAIL":null,"TEST_EMAIL_ADDRESS":null,"EMAIL_LOGO_URL":null,"EMAIL_SUPPORT_CONTACT":null}},{"name":"ms_teams","variables":{"MS_TEAMS_WEBHOOK_URL":null}}],"active_alerting_destinations":[],"router_settings":{"routing_strategy_args":{},"routing_strategy":"simple-shuffle","allowed_fails":3,"cooldown_time":5,"num_retries":2,"timeout":6000.0,"retry_after":0,"fallbacks":null,"context_window_fallbacks":null,"model_group_retry_policy":{},"retry_policy":null,"model_group_alias":{},"enable_weighted_failover":false,"enable_mid_stream_fallback_continuation":false,"enable_tag_filtering":false,"tag_routing_prefix":"","fallback_on_unsupported_params":true,"routing_groups":[]},"available_callbacks":{"langfuse":{"litellm_callback_name":"langfuse","litellm_callback_params":["LANGFUSE_PUBLIC_KEY","LANGFUSE_SECRET_KEY","LANGFUSE_HOST"],"ui_callback_name":"Langfuse"},"otel":{"litellm_callback_name":"otel","litellm_callback_params":["OTEL_EXPORTER","OTEL_EXPORTER_OTLP_PROTOCOL","OTEL_ENDPOINT","OTEL_TRACES_ENDPOINT","OTEL_HEADERS"],"ui_callback_name":"OpenTelemetry"},"s3":{"litellm_callback_name":"s3","litellm_callback_params":["AWS_ACCESS_KEY_ID","AWS_SECRET_ACCESS_KEY","AWS_REGION_NAME","S3_LOG_PROMPTS_ONLY","S3_PARTITION_GRANULARITY"],"ui_callback_name":"s3 Bucket (AWS)"},"azure_sentinel":{"litellm_callback_name":"azure_sentinel","litellm_callback_params":["AZURE_SENTINEL_DCR_IMMUTABLE_ID","AZURE_SENTINEL_ENDPOINT","AZURE_SENTINEL_TENANT_ID","AZURE_SENTINEL_CLIENT_ID","AZURE_SENTINEL_CLIENT_SECRET","AZURE_SENTINEL_STREAM_NAME"],"ui_callback_name":"Azure Sentinel"},"openmeter":{"litellm_callback_name":"openmeter","litellm_callback_params":["OPENMETER_API_ENDPOINT","OPENMETER_API_KEY"],"ui_callback_name":"OpenMeter"},"custom_callback_api":{"litellm_callback_name":"custom_callback_api","litellm_callback_params":["GENERIC_LOGGER_ENDPOINT","GENERIC_LOGGER_HEADERS"],"ui_callback_name":"Custom Callback API"},"generic_api":{"litellm_callback_name":"generic_api","litellm_callback_params":["GENERIC_LOGGER_ENDPOINT","GENERIC_LOGGER_HEADERS"],"ui_callback_name":"Custom Callback API"},"datadog":{"litellm_callback_name":"datadog","litellm_callback_params":["DD_API_KEY","DD_SITE"],"ui_callback_name":"Datadog"},"braintrust":{"litellm_callback_name":"braintrust","litellm_callback_params":["BRAINTRUST_API_KEY","BRAINTRUST_API_BASE"],"ui_callback_name":"Braintrust"},"langsmith":{"litellm_callback_name":"langsmith","litellm_callback_params":["LANGSMITH_API_KEY","LANGSMITH_PROJECT","LANGSMITH_DEFAULT_RUN_NAME"],"ui_callback_name":"Langsmith"},"lago":{"litellm_callback_name":"lago","litellm_callback_params":["LAGO_API_BASE","LAGO_API_KEY","LAGO_API_EVENT_CODE","LAGO_API_CHARGE_BY"],"ui_callback_name":"Lago Billing"},"traceloop":{"litellm_callback_name":"traceloop","litellm_callback_params":["TRACELOOP_API_KEY"],"ui_callback_name":"Traceloop"},"galileo":{"litellm_callback_name":"galileo","litellm_callback_params":["GALILEO_API_KEY","GALILEO_PROJECT_ID","GALILEO_LOG_STREAM_ID","GALILEO_BASE_URL","GALILEO_USERNAME","GALILEO_PASSWORD"],"ui_callback_name":"Galileo"},"newrelic":{"litellm_callback_name":"newrelic","litellm_callback_params":["NEW_RELIC_AI_MONITORING_RECORD_CONTENT_ENABLED"],"ui_callback_name":"New Relic"},"pointfive":{"litellm_callback_name":"pointfive","litellm_callback_params":["POINTFIVE_API_KEY","POINTFIVE_API_URL"],"ui_callback_name":"PointFive"},"signoz":{"litellm_callback_name":"signoz","litellm_callback_params":["SIGNOZ_INGESTION_ENDPOINT","SIGNOZ_INGESTION_KEY"],"ui_callback_name":"SigNoz"},"zerobus":{"litellm_callback_name":"zerobus","litellm_callback_params":["ZEROBUS_WORKSPACE_URL","ZEROBUS_SERVER_ENDPOINT","ZEROBUS_CLIENT_ID","ZEROBUS_CLIENT_SECRET","ZEROBUS_TABLE_NAME"],"ui_callback_name":"Databricks Zerobus"}}}

14. Control, unknown key

  1. Run:
curl -sS "$PROXY/team/info?team_id=whatever" -H "Authorization: Bearer sk-not-a-real-key-qa"
  1. Observed, HTTP 401:
{"error":{"message":"Authentication Error, Invalid API key provided.","type":"token_not_found_in_db","param":"key","code":"401"}}

15. Control, wrong UI password

  1. Run:
curl -sS -X POST "$PROXY/login" -d 'username=admin&password=definitely-wrong-qa'
  1. Observed, HTTP 401:
{"error":{"message":"Invalid credentials used to access UI. Check 'UI_USERNAME' and 'UI_PASSWORD', or the password set for your user","type":"auth_error","param":"invalid_credentials","code":"401"}}

Observations from the run:

  • Queue routes already answer invalid_request_error on main
  • Case 13 does not reach the catch-all on either leg
  • Messages still carry a stringified dict, untouched here
  • param goes from the string "None" to JSON null

Type

🐛 Bug Fix

Final Attestation

  • The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR

@mateo-berri

Copy link
Copy Markdown
Contributor Author

@litellm-stampbot

@kerry-berri

kerry-berri commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

litellm-stampbot: risk low

Approved at a692298.

Rules (stampbot/risk_rules.yml):

  • low: 0 changed source lines (only tests, docs, cookbook, markdown or the cost map changed), approved without asking Bugbot or the judge

Judge: skipped, the rules alone decided.

Pushes do not re-run this check. Comment @litellm-stampbot again to re-check the new head.

@kerry-berri kerry-berri added the risk:low Small, isolated, low-risk change label Oct 21, 2026

@kerry-berri kerry-berri left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Low risk by rule and by judgement at a692298

@codecov

codecov Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.67442% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...y/management_endpoints/key_management_endpoints.py 75.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

…es with 503 in route catch-alls

/key/list and /key/aliases now share the catch-all helper too, so they stop
adding the Authentication Error prefix and typing a 400 as internal_server_error
…ror_types_main

# Conflicts:
#	tests/unit/proxy/health_endpoints/test_health_endpoints.py
#	tests/unit/proxy/management_endpoints/test_key_management_endpoints.py
#	tests/unit/proxy/management_endpoints/test_organization_endpoints.py
#	tests/unit/proxy/test_proxy_server.py
@mateo-berri

Copy link
Copy Markdown
Contributor Author

Superseded by #48739, which carries these same commits from a fork branch so the review can go through. Closing this one

@codspeed

codspeed Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 35 untouched benchmarks


Comparing litellm_management_error_types_main (8cbf2cc) with main (e32d8a4)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (6fe0263) during the generation of this report, so e32d8a4 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@mateo-berri
mateo-berri deleted the litellm_management_error_types_main branch October 28, 2026 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:low Small, isolated, low-risk change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants