Repository navigation
Description
Check for existing issues
- I have searched the existing issues and checked that my issue is not a duplicate.
Related (same fallthrough, different ask — please do not close this as a duplicate):
- Chat completions bridged to Responses drops usage on response.incomplete #34351 — usage dropped on
response.incomplete/response.failed. PR fix(responses): preserve usage on incomplete chat stream bridge #34352 still mapsfailed→finish_reason=stop. - [Bug]: Response.incomplete is unhandled in responses->chat streaming transform and drops content_filters #27186 —
response.incompleteunhandled in the sameelse: pass. - [Bug]: Errors mid stream not re-raise in Responses API with Openai models #29223 —
response.failedis yielded, not raised, on/v1/responses(not this chat path). - fix(responses-api): raise APIError on in-stream error events; widen ErrorEventError.param to accept dict #31787 — raise on
response.failedlanded on the Responses iterator only. - https://github.com/windbit/agentek-litellm/pull/15 — fork that raises
APIErroronfailed/erroron this chat bridge (the behavior we want).
What happened?
A streaming POST /v1/chat/completions to a Responses-only model (Bedrock Mantle openai.gpt-5.6-* and any other chat→Responses bridge) is accepted and held for ~30–50s. Upstream then ends the SSE with type=response.failed / server_error ("The server had an error while processing your request"). Zero output tokens.
The proxy still returns HTTP 200. The chat stream closes as a normal empty completion (finish_reason=stop, no content, no usage). Configured model-group fallbacks never run, because the call looks successful. Proxy application logs have no APIError line; the failure exists only as an OTel gen_ai span with status=error.
Expected: the proxy raises (litellm.APIError) on response.failed / error in the chat→Responses stream translator so router fallbacks and client retries fire, instead of a silent empty stop.
Please do not resolve this by mapping response.failed to finish_reason=stop (that is what #34352 does). That keeps the empty-success symptom.
User Flow
Before a (hypothetical) fix: a developer whose app streams chat completions through the proxy gets HTTP 200 and an empty answer when the model fails mid-stream, so configured fallbacks never run.
- They send
POST https://<proxy>/v1/chat/completionswith a Responses-only model (e.g.gpt-5.6-luna),stream=true, and a normal user message. The proxy is configured so that model falls back to two sibling models. - The HTTP response starts as
200 text/event-stream. For ~40s they receive no text deltas. - The stream ends with a
chat.completion.chunkwhosechoices[0].finish_reasonis"stop"and delta content is empty. Status stays 200. - They open
https://<proxy>/ui/?page=logs(or their client logs) and see a successful call with 0 output tokens. The fallback models were never tried. Their app treats the turn as finished with no answer.
After a (hypothetical) fix: the same mid-stream model failure is returned as an error, so the proxy walks the fallback list and the app gets a real answer or a visible error.
- They send the same
POST https://<proxy>/v1/chat/completionswithstream=true. - The HTTP response may still open as 200 (SSE already started). When upstream emits
response.failed, the proxy surfaces an error on that stream (or retries the fallback models before closing). - If a fallback answers, they see text deltas and a normal
stopfrom that model. If every sibling fails, they see an error chunk / non-success — not an emptystop. https://<proxy>/ui/?page=logsshows a failed primary attempt (or a fallback hop), not a successful empty completion.
Proof the bug occurs
Code still present on v1.90.0, v1.91.0, and current main: OpenAiResponsesToChatCompletionStreamIterator.translate_responses_chunk_to_openai_stream in litellm/completion_extras/litellm_responses_transformation/transformation.py handles response.created, output_item.added, output_text.delta, response.completed, etc. There is no response.failed branch. The event hits else: pass, logs Unhandled event type 'response.failed', creating empty chunk at DEBUG, and returns an empty ModelResponseStream with finish_reason=None. The stream wrapper then synthesizes finish_reason=stop. Usage is copied only in the response.completed branch.
Live provider server_error is intermittent (~30–50s). The translator path can be exercised by feeding the iterator:
{"type":"response.created","response":{"id":"resp_example","status":"in_progress"}}
{"type":"response.failed","response":{"id":"resp_example","status":"failed","error":{"code":"server_error","message":"The server had an error while processing your request"},"output":[],"usage":null}}Expected after a fix: litellm.APIError (status 500 for server_error). Actual today: empty chat chunk, then stop.
Live capture shape (redact secrets):
curl -sN https://<proxy>/v1/chat/completions \
-H "Authorization: Bearer <redacted>" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.6-luna",
"stream": true,
"stream_options": {"include_usage": true},
"messages": [{"role": "user", "content": "ping"}]
}'Look for HTTP 200, last chunk finish_reason=stop with empty content, and in --detailed_debug a raw event type=response.failed.
What part of LiteLLM is this about?
Proxy
What LiteLLM version are you on ?
v1.90.0 (also checked v1.91.0 and main — chat-bridge response.failed branch still absent)
Activity
nightcityblade commentedon Aug 13, 2026
Hi, I'd like to work on this. I'll submit a PR shortly.
github-actions commentedon Nov 12, 2026
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.