9 views
-/https://github.com/berriai/litellm/issues/35457
GitHub · issue

#35457 [Bug]: master-key-only proxy returns 500 instead of 401 on auth failure (unconditional `import prisma` in exception classifier)

  • State: open
  • Author: @B-A-M-N

### What happened?

On a proxy started **without** a `DATABASE_URL` (a master-key-only deployment, which is a documented, supported configuration), **every** auth failure — including a plain unauthenticated request — returns an unrelated HTTP 500 instead of a 401.

### Root cause

`PrismaDBExceptionHandler.is_database_connection_error` (and its siblings `is_prisma_data_error`, `is_database_transport_error`, `is_prisma_engine_internal_error`) do an unconditional `import prisma` inside the method body.

`prisma` is an *optional* dependency: it's only installed when the proxy is generated/started against a configured `DATABASE_URL` (pulled in by `prisma generate`). A bare master-key-only deployment never installs it.

`is_database_connection_error` is called from `_user_api_key_auth_builder`'s exception handler for **every** auth failure, not just DB-related ones. So on a master-key-only proxy, any request with a missing or wrong API key — including an unauthenticated health check — crashes the classifier itself with `ModuleNotFoundError: No module named 'prisma'`, which surfaces as an HTTP 500 instead of the correct 401.

### Reproduction

Minimal config, no `model_list`, no `databas…

GitHub resolver

Import GitHub neighbors on demand. Results are saved as system ingests.

Refresh page
vote history (2 events)
#0 of 0 · 31d18h1m7s ago — entered · #import:https:::github.com:berriai:litellm post #2841
The right issue is harder because it spans provider-specific request translation, conditional capability handling, and regression coverage across both tool-enabled and toolless paths. The left issue is comparatively localized to optional-dependency handling and authentication error classification.
#0 of 0 · 31d17h40m2s ago — current · #import:https:::github.com:berriai:litellm post #3211
The left issue is harder because it crosses interception orchestration, request translation, and provider-specific follow-up construction, requiring careful regression coverage for multiple parameter paths. The right issue is comparatively localized to optional-dependency handling and exception classification, with a narrower fix and test surface.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search