litellm - ✅(Solved) Fix [Bug]: /prompts/list returns 401 for internal_user — route missing from self_managed_routes [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
BerriAI/litellm#24307Fetched 2026-04-08 01:13:28
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Author
Participants
Timeline (top)
cross-referenced ×1referenced ×1

The /prompts/list endpoint returns 401 Unauthorized for users with internal_user role, even though the endpoint is intended to be accessible to non-admin users.

Error Message

internal_user and other non-admin roles should be able to list prompts (read-only access) without a 401 error.

Root Cause

There is a singular/plural naming mismatch between the route definition and the self_managed_routes whitelist:

  • Route defined as (plural): @router.get("/prompts/list") in litellm/proxy/prompts/prompt_endpoints.py
  • Whitelist entry (singular): "/prompt/list" in litellm/proxy/_types.pyself_managed_routes

Because "/prompts/list" is not in self_managed_routes, the proxy's route permission checker falls back to requiring PROXY_ADMIN privileges, causing a 401 for internal_user sessions.

Fix Action

Fix

Add "/prompts/list" (plural) to self_managed_routes in litellm/proxy/_types.py:

# litellm/proxy/_types.py
self_managed_routes: List[str] = [
    ...
    "/prompts/list",   # was "/prompt/list" — typo, route is actually plural
    ...
]

I have a one-line fix ready and can submit a PR.

PR fix notes

PR #24311: fix(proxy): add /prompts/list to self_managed_routes (fixes 401 for internal_user)

Description (problem / solution / changelog)

Summary

Fixes a one-character naming mismatch that causes GET /prompts/list to return 401 Unauthorized for internal_user and other non-admin roles.

Fixes #24307

Root Cause

self_managed_routes contained "/prompt/list" (singular), but the actual endpoint is registered as @router.get("/prompts/list") (plural) in litellm/proxy/prompts/prompt_endpoints.py.

Because the route isn't in the whitelist, the proxy's permission checker requires PROXY_ADMIN for any request to /prompts/list, causing a 401 for non-admin users.

Change

# litellm/proxy/_types.py
  "/prompt/list",
  "/prompt/info",
+ "/prompts/list",  # plural route alias — endpoint is @router.get("/prompts/list")

Testing

  • ✅ Verified: internal_user API key can now successfully call GET /prompts/list
  • ✅ No change to access control for other routes
  • ✅ Existing /prompt/list entry preserved for backward compatibility

Impact

  • Minimal: 1-line addition to a list constant
  • No breaking changes
  • Affected roles: internal_user, team, any non-PROXY_ADMIN role

Changed files

  • litellm/proxy/_types.py (modified, +3/-2)

Code Example

# litellm/proxy/_types.py
self_managed_routes: List[str] = [
    ...
    "/prompts/list",   # was "/prompt/list" — typo, route is actually plural
    ...
]
RAW_BUFFERClick to expand / collapse

Description

The /prompts/list endpoint returns 401 Unauthorized for users with internal_user role, even though the endpoint is intended to be accessible to non-admin users.

Root Cause

There is a singular/plural naming mismatch between the route definition and the self_managed_routes whitelist:

  • Route defined as (plural): @router.get("/prompts/list") in litellm/proxy/prompts/prompt_endpoints.py
  • Whitelist entry (singular): "/prompt/list" in litellm/proxy/_types.pyself_managed_routes

Because "/prompts/list" is not in self_managed_routes, the proxy's route permission checker falls back to requiring PROXY_ADMIN privileges, causing a 401 for internal_user sessions.

Steps to Reproduce

  1. Create an internal_user API key
  2. Make a GET /prompts/list request with that key
  3. Observe 401 Unauthorized response

Expected Behavior

internal_user and other non-admin roles should be able to list prompts (read-only access) without a 401 error.

Fix

Add "/prompts/list" (plural) to self_managed_routes in litellm/proxy/_types.py:

# litellm/proxy/_types.py
self_managed_routes: List[str] = [
    ...
    "/prompts/list",   # was "/prompt/list" — typo, route is actually plural
    ...
]

I have a one-line fix ready and can submit a PR.

Environment

  • LiteLLM proxy (latest main)
  • Affected roles: internal_user, team, any non-PROXY_ADMIN role

extent analysis

Fix Plan

To resolve the issue, update the self_managed_routes list in litellm/proxy/_types.py to include the correct plural route:

# litellm/proxy/_types.py
self_managed_routes: List[str] = [
    ...
    "/prompts/list",  # Corrected plural route
    ...
]

Verification

  1. Rebuild and redeploy the LiteLLM proxy with the updated code.
  2. Create an internal_user API key.
  3. Make a GET /prompts/list request with the internal_user API key.
  4. Verify a successful response (200 OK) without a 401 Unauthorized error.

Extra Tips

  • Double-check route definitions and whitelist entries for consistency to prevent similar issues.
  • Consider implementing automated tests to catch naming mismatches and permission errors.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

litellm - ✅(Solved) Fix [Bug]: /prompts/list returns 401 for internal_user — route missing from self_managed_routes [1 pull requests, 1 participants]