Skip to content

[Bug]: /v1/chat/completions stream: response.failed becomes HTTP 200 + empty finish_reason=stop (fallbacks never run) #36768

Closed as not planned

Description

@moravron

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):

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.

  1. They send POST https://<proxy>/v1/chat/completions with 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.
  2. The HTTP response starts as 200 text/event-stream. For ~40s they receive no text deltas.
  3. The stream ends with a chat.completion.chunk whose choices[0].finish_reason is "stop" and delta content is empty. Status stays 200.
  4. 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.

  1. They send the same POST https://<proxy>/v1/chat/completions with stream=true.
  2. 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).
  3. If a fallback answers, they see text deltas and a normal stop from that model. If every sibling fails, they see an error chunk / non-success — not an empty stop.
  4. https://<proxy>/ui/?page=logs shows 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

  1. nightcityblade commented on Aug 13, 2026

    @nightcityblade

    Hi, I'd like to work on this. I'll submit a PR shortly.

  2. github-actions commented on Nov 12, 2026

    @github-actions
    Contributor

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions