litellm - ✅(Solved) Fix [Bug]: PriceDataManagementTab always rendered for non-admin users — causes repeated 401 errors on cost_map 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#24308Fetched 2026-04-08 01:13:26
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
0
Author
Participants
Timeline (top)
referenced ×2cross-referenced ×1

In ModelsAndEndpointsView.tsx, the PriceDataManagementTab component is always mounted regardless of the user's role, even though the Tab label is already correctly guarded with an admin role check.

This causes internal_user and other non-admin users to generate repeated 401 Unauthorized errors in server logs every ~30 seconds, because the component polls admin-only endpoints:

  • GET /schedule/model_cost_map_reload/status
  • GET /model/cost_map/source

Error Message

ERROR - GET /schedule/model_cost_map_reload/status - 401 Unauthorized ERROR - GET /model/cost_map/source - 401 Unauthorized

Root Cause

In ModelsAndEndpointsView.tsx, the <Tab> label has a correct admin guard, but the corresponding <TabPanel> does not:

// Tab label — correctly guarded ✅
{all_admin_roles.includes(userRole) && (
  <Tab>Price Data Management</Tab>
)}

// TabPanel — NOT guarded ❌ (always renders + polls admin routes)
<TabPanels>
  ...
  <PriceDataManagementTab />   // missing role check
</TabPanels>

Fix Action

Fix

Align the TabPanel render with the existing Tab guard:

{all_admin_roles.includes(userRole) && <PriceDataManagementTab />}

One-line fix. I have a PR ready.

PR fix notes

PR #24312: fix(ui): guard PriceDataManagementTab TabPanel with admin role check

Description (problem / solution / changelog)

Summary

Fixes a missing role guard on the PriceDataManagementTab TabPanel that causes repeated 401 errors in proxy logs for all non-admin user sessions.

Fixes #24308

Root Cause

In ModelsAndEndpointsView.tsx, the Tab label was already correctly guarded:

{all_admin_roles.includes(userRole) && <Tab>Price Data Reload</Tab>}  // ✅ guarded

But the corresponding TabPanel was rendered unconditionally:

<PriceDataManagementTab />  // ❌ no role guard — always mounts

PriceDataManagementTab polls two admin-only endpoints every ~30 seconds:

  • GET /schedule/model_cost_map_reload/status
  • GET /model/cost_map/source

For internal_user and other non-admin roles, every poll produces a 401 Unauthorized error in the server logs.

Change

- <PriceDataManagementTab />
+ {all_admin_roles.includes(userRole) && <PriceDataManagementTab />}

One-line fix. Aligns the TabPanel render condition with the existing Tab label guard.

Testing

  • internal_user sessions no longer trigger 401 errors for /schedule/model_cost_map_reload/status or /model/cost_map/source
  • ✅ Admin users still see and can use the Price Data Reload tab normally
  • ✅ No visual regression for admin users

Impact

  • Minimal: 1-line change
  • No breaking changes
  • Affected roles: internal_user, team, any non-admin role

Changed files

  • ui/litellm-dashboard/src/app/(dashboard)/models-and-endpoints/ModelsAndEndpointsView.tsx (modified, +1/-1)

Code Example

// Tab label — correctly guarded ✅
{all_admin_roles.includes(userRole) && (
  <Tab>Price Data Management</Tab>
)}

// TabPanel — NOT guarded ❌ (always renders + polls admin routes)
<TabPanels>
  ...
  <PriceDataManagementTab />   // missing role check
</TabPanels>

---

ERROR - GET /schedule/model_cost_map_reload/status - 401 Unauthorized
ERROR - GET /model/cost_map/source - 401 Unauthorized

---

{all_admin_roles.includes(userRole) && <PriceDataManagementTab />}
RAW_BUFFERClick to expand / collapse

Description

In ModelsAndEndpointsView.tsx, the PriceDataManagementTab component is always mounted regardless of the user's role, even though the Tab label is already correctly guarded with an admin role check.

This causes internal_user and other non-admin users to generate repeated 401 Unauthorized errors in server logs every ~30 seconds, because the component polls admin-only endpoints:

  • GET /schedule/model_cost_map_reload/status
  • GET /model/cost_map/source

Root Cause

In ModelsAndEndpointsView.tsx, the <Tab> label has a correct admin guard, but the corresponding <TabPanel> does not:

// Tab label — correctly guarded ✅
{all_admin_roles.includes(userRole) && (
  <Tab>Price Data Management</Tab>
)}

// TabPanel — NOT guarded ❌ (always renders + polls admin routes)
<TabPanels>
  ...
  <PriceDataManagementTab />   // missing role check
</TabPanels>

Impact

For every non-admin user session, the proxy logs:

ERROR - GET /schedule/model_cost_map_reload/status - 401 Unauthorized
ERROR - GET /model/cost_map/source - 401 Unauthorized

These repeat on ~30-second intervals for as long as the user has the Models & Endpoints page open.

Fix

Align the TabPanel render with the existing Tab guard:

{all_admin_roles.includes(userRole) && <PriceDataManagementTab />}

One-line fix. I have a PR ready.

Environment

  • LiteLLM Dashboard (latest main)
  • Affected roles: internal_user, team, any non-admin role
  • Affected page: /models-and-endpoints

extent analysis

Fix Plan

To fix the issue, we need to add a role check for the PriceDataManagementTab component. Here are the steps:

  • Update the TabPanels section in ModelsAndEndpointsView.tsx to include the role check.
  • Use the existing all_admin_roles.includes(userRole) condition to guard the PriceDataManagementTab component.

Example code:

<TabPanels>
  ...
  {all_admin_roles.includes(userRole) && <PriceDataManagementTab />}
</TabPanels>

This will ensure that the PriceDataManagementTab component is only rendered for admin users, preventing the repeated 401 Unauthorized errors.

Verification

To verify that the fix worked:

  • Open the Models & Endpoints page as a non-admin user.
  • Check the server logs for 401 Unauthorized errors related to the GET /schedule/model_cost_map_reload/status and GET /model/cost_map/source endpoints.
  • The errors should no longer appear in the logs.

Extra Tips

  • Make sure to test the fix with different user roles to ensure that the PriceDataManagementTab component is only accessible to admin users.
  • Consider adding additional logging or monitoring to detect similar issues in the future.

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]: PriceDataManagementTab always rendered for non-admin users — causes repeated 401 errors on cost_map routes [1 pull requests, 1 participants]