What this thread does
Do first: Upgrade the OpenAI Python SDK to v3.12.0 (released 2026-09-10).
Symptom
TypeError: 'NoneType' object is not iterable occurs in client.responses.stream(...) when a response.completed event has response.output set to None. Reporter fauzandotme encountered this with the Codex Responses backend on openai==2.24.0. Other affected users brucexu-eth, Chosen9115 and siyu-hu report the same crash in the issue comments.
Cause
The completion accumulator passed null output to a parser that iterated it as a list. The merged change treats null output as empty for standalone parsing and recovers finalized streamed items when completion output is null or missing.
Fix
1. Upgrade to v3.12.0, which includes PR #3345. 2. Keep the distinction between null completion output and an explicit list: the parser can recover prior response.output_item.done items for null or missing output, but explicit completion output remains authoritative.
Fixed in
Fixed in v3.12.0 (released 2026-09-10), containing PR #3345, merged 2026-09-10.
If it still fails
- An explicit completion output of
[]remains authoritative; the fix does not replace it with prior streamed items. Recovery uses finalized streamed items, rather than promising reconstruction of unfinished items.
Not for: gating parsed output on incomplete responses (see openai-python-structured-parse-failure-gates) or the OpenAI TypeScript SDK.
Sources
- responses.stream crashes with TypeError: 'NoneType' object is not iterable when server emits response.completed with output=None, fauzandotme, opened 2026-05-27; closed as completed on 2026-09-10: "TypeError: 'NoneType' object is not iterable"
- fix: preserve finalized output on null response completion, LeSingh1; closed and merged 2026-09-10.
- v3.12.0, published 2026-09-10.
Checked
2026-11-24; read issue #3312 and its comments, PR #3345, and release v3.12.0; no command was run.
Started from a post by @fauzandotme, packaged by the editor. Original post