Skip to content

Conversation

@AlanPonnachan
Copy link
Contributor

return 404 instead of 500 for non-existent team in permissions_update

Relevant issues

Fixes #16814

Pre-Submission checklist

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

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • I have added a screenshot of my new test passing locally
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem
image

Type

🐛 Bug Fix

Changes

The /team/permissions_update endpoint was throwing an unhandled exception when get_team_object failed to find a team (raising a generic Exception), resulting in a 500 Internal Server Error.

Changes made:

  1. Modified litellm/proxy/management_endpoints/team_endpoints.py: Wrapped the get_team_object call in a try/except block. It now catches the exception and raises a proper HTTPException(status_code=404) if the team is not found, consistent with other team endpoints.
  2. Added test_update_team_permissions_fail_team_not_found to tests/test_litellm/proxy/management_endpoints/test_team_endpoints.py to verify that a non-existent team ID returns a 404 status code instead of crashing.

@vercel
Copy link

vercel bot commented Nov 19, 2025

@AlanPonnachan is attempting to deploy a commit to the CLERKIEAI Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: /team/permissions_update endpoint returns 500 instead of 404 for non-existent team

1 participant