{"record":{"id":"80f1b88460ca1adb","repo":"BerriAI/litellm","slug":"stream-ended-without-a-completed-response","errorCode":null,"errorMessage":"Stream ended without a completed response","messagePattern":"Stream ended without a completed response","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/completion_extras/litellm_responses_transformation/handler.py","lineNumber":79,"sourceCode":"            raise ValueError(\"Unexpected responses stream payload\")\n\n        if hidden_params:\n            existing: Final = getattr(response, \"_hidden_params\", None)\n            if not isinstance(existing, dict) or not existing:\n                setattr(response, \"_hidden_params\", dict(hidden_params))\n            else:\n                for key, value in hidden_params.items():\n                    existing.setdefault(key, value)\n        return response\n\n    def _collect_response_from_stream(self, stream_iter: Any) -> \"ResponsesAPIResponse\":\n        for _ in stream_iter:\n            pass\n\n        completed: Final = getattr(stream_iter, \"completed_response\", None)\n        response_obj: Final = getattr(completed, \"response\", None) if completed else None\n        if response_obj is None:\n            raise ValueError(\"Stream ended without a completed response\")\n\n        hidden_params: Final = getattr(stream_iter, \"_hidden_params\", None)\n        response: Final = self._coerce_response_object(response_obj, hidden_params)\n        if not isinstance(response, ResponsesAPIResponse):\n            raise ValueError(\"Stream completed response is invalid\")\n        return response\n\n    async def _collect_response_from_stream_async(self, stream_iter: Any) -> \"ResponsesAPIResponse\":\n        async for _ in stream_iter:\n            pass\n\n        completed: Final = getattr(stream_iter, \"completed_response\", None)\n        response_obj: Final = getattr(completed, \"response\", None) if completed else None\n        if response_obj is None:\n            raise ValueError(\"Stream ended without a completed response\")\n\n        hidden_params: Final = getattr(stream_iter, \"_hidden_params\", None)\n        response: Final = self._coerce_response_object(response_obj, hidden_params)","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/completion_extras/litellm_responses_transformation/handler.py#L61-L97","documentation":"_collect_response_from_stream exhausted the stream iterator without ever capturing a completed ResponsesAPIResponse, meaning the SSE stream terminated early (network drop or truncated provider output) and no result could be returned.","triggerScenarios":"Thrown at litellm/completion_extras/litellm_responses_transformation/handler.py:79 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the request; the provider closed the stream before sending a response.completed event.","If persistent, check provider status and confirm the model supports streaming for the responses API."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}