chore(router): simplify unknown-model error message construction - #31566
Merged
yuneng-berri merged 2 commits intoJun 29, 2026
Merged
Conversation
The error string is already produced by the f-string interpolation; the trailing .format() call on it was redundant. Add a regression test that the message renders the model name verbatim.
Contributor
Greptile SummaryThis PR simplifies Router unknown-model error message construction. The main changes are:
Confidence Score: 5/5The change is narrowly scoped to redundant string formatting removal and is covered by a focused regression test. The implementation preserves the existing constructed error message while eliminating the extra formatting step, and the added test exercises the relevant edge case for literal model names.
What T-Rex did
Reviews (1): Last reviewed commit: "chore(router): simplify unknown-model er..." | Re-trigger Greptile |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
get_model_list always returns a list, never None, so the is-None branch could not execute. Collapse to the single reachable message.
yuneng-berri
changed the base branch from
litellm_internal_staging
to
litellm_yj_june29
June 29, 2026 18:55
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
The unknown-model error message in
Routeris already fully built by the f-string interpolation, so the trailing.format()call on the resulting string was redundant. This removes it and adds a regression test that the message renders the model name verbatim.Type
🧹 Refactoring