Repository navigation
Conversation
Every routing failure used to collapse into the same 500 with
{"error": "Failed to route request for model ..."}: an invalid sampling
parameter, an unknown model and an unreachable engine were indistinguishable
to clients, and the engine's OpenAI-shaped error body was dropped.
route_request() now raises a typed RouteError instead of returning None:
- UpstreamError carries the engine's own status, body and content type, so a
400/404/429/503 passes through unchanged; that includes the streaming
branch, which used to report a rejected stream as a generic 500;
- ModelNotFoundError, BackendUnavailableError and GatewayTimeoutError map to
404, 503 and 504 for router-side failures;
- the frontend answers malformed JSON with 400 instead of 500 and keeps the
OpenAI error schema for its own 500s.
Traffic monitoring still records every attempt, including the new failure
paths.
Add tests/test_controller_errors.py: the status mapping, the verbatim upstream
body, malformed JSON, a fake engine returning 400/503, an unknown model and an
unreachable endpoint.
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.
What
Follow-up to the merged #615 (same file family).
Every routing failure collapsed into the same response:
Measured against a real vLLM 0.29 backend:
temperature: -5400+{"error":{"message":"temperature must be non-negative...","type":"BadRequestError","param":"temperature","code":400}}500+Failed to route request for model ...500(should be 404)500(should be 400)500with the same generic textClients cannot tell a bad parameter from a routing failure, cannot show the engine's message, and cannot decide whether to retry.
Changes
controller/router.pyroute_request()raises a typedRouteErrorinstead of returningNone:UpstreamError(status, body, content_type)— the engine answered non-2xx; its status, OpenAI-shaped body and content type are preserved. Applies to both branches; the streaming branch used to drop the body entirely and report a rejected stream as a generic 500;ModelNotFoundError-> 404,BackendUnavailableError-> 503 (wake-up failure, unreachable engine, closed session),GatewayTimeoutError-> 504._read_error_body()keeps a non-JSON engine body (plain-text 5xx) by wrapping it in the OpenAI error schema.controller/frontend.pyRouteErroris translated to its status and payload;json.JSONDecodeErrorbecomes400 BadRequestError; unexpected exceptions stay 500 but now use the OpenAI error schema too.Tests
tests/test_controller_errors.py(registered intests/manifests/cpu.txt):Verification
Live check on a two-model vLLM 0.29 + kvcached stack (one RTX 5090), same requests before and after: