{"record":{"id":"37c5c98bd1b18986","repo":"BerriAI/litellm","slug":"file-content-stream-does-not-support-async-iterati","errorCode":null,"errorMessage":"File content stream does not support async iteration","messagePattern":"File content stream does not support async iteration","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"litellm/files/streaming.py","lineNumber":67,"sourceCode":"            raise TypeError(\"File content stream does not support sync iteration\")\n        return self\n\n    def __next__(self) -> bytes:\n        if not hasattr(self.stream_iterator, \"__next__\"):\n            raise TypeError(\"File content stream does not support sync iteration\")\n\n        try:\n            return next(cast(Iterator[bytes], self.stream_iterator))\n        except StopIteration:\n            self._log_success_sync()\n            raise\n        except Exception as e:\n            self._log_failure_sync(e)\n            raise\n\n    def __aiter__(self) -> \"FileContentStreamingResponse\":\n        if not hasattr(self.stream_iterator, \"__anext__\"):\n            raise TypeError(\"File content stream does not support async iteration\")\n        return self\n\n    async def __anext__(self) -> bytes:\n        if not hasattr(self.stream_iterator, \"__anext__\"):\n            raise TypeError(\"File content stream does not support async iteration\")\n\n        try:\n            return await cast(AsyncIterator[bytes], self.stream_iterator).__anext__()\n        except StopAsyncIteration:\n            await self._log_success_async()\n            raise\n        except Exception as e:\n            await self._log_failure_async(e)\n            raise\n\n    async def aclose(self) -> None:\n        if self._close_completed:\n            return","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/files/streaming.py#L49-L85","documentation":"Raised by FileContentStreamingResponse.__aiter__ when the wrapped stream_iterator lacks the async iteration protocol (__anext__). The underlying response only supports sync iteration, so async for-over it is rejected rather than hanging.","triggerScenarios":"Thrown at litellm/files/streaming.py:67 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use synchronous iteration on this file content stream, or read the full content at once.","Do not use async for on a sync-only stream."],"exampleFix":null,"handlingStrategy":"validation","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"}