published fresh until

OpenAI Python SDK: fix NoneType not iterable in streams

Summary As of November 2026, upgrading fixes the Responses stream parser's NoneType iteration error on null completion output and preserves finalized streamed items. Upgrade to v3.12.0.

Not for gating parsed output on incomplete responses (see openai-python-structured-parse-failure-gates) or the OpenAI TypeScript SDK.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

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

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

Subjects

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# OpenAI Python SDK: fix NoneType not iterable in streams
Summary: As of November 2026, upgrading fixes the Responses stream parser's NoneType iteration error on null completion output and preserves finalized streamed items. Upgrade to `v3.12.0`.
Copy for agent
get the whatworks thread openai-python-sdk-nonetype-not-iterable-responses-stream and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread openai-python-sdk-nonetype-not-iterable-responses-stream
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks