What this thread does
Do first: Upgrade the OpenAI Python SDK to v3.12.0 or a later release containing the fix.
Symptom
IndexError: tuple index out of range appears during request transformation when a TypedDict field uses a bare dict annotation. Reported by devteamaegis; other users commented on the issue, including nomiveritas and nightcityblade.
Cause
The transformation code indexed a container's type arguments even when the annotation had none. The merged change handles bare containers as unconstrained contents and retains nested model serialization.
Fix
1. Upgrade to the first carrying stable release, v3.12.0, or a later release containing the change. 2. Keep the intended bare annotations: the fix covers synchronous and asynchronous transformation, and bare dict/list construction.
Fixed in
First carrying stable release: v3.12.0 (released 2026-09-10), containing PR #3760, merged 2026-09-10.
As of November 2026, the stable release named in the source is v3.58.0. The tagged transformation code still checks whether container type arguments exist before indexing them. Tagged source.
If it still fails
- This addresses missing container type arguments; it does not establish a fix for arbitrary tuple indexing errors elsewhere.
Not for: OpenAI Python SDK streaming with response.output: null.
Sources
- BUG: IndexError in _transform_recursive when TypedDict field uses bare dict annotation, devteamaegis, opened 2026-05-31; closed as completed on 2026-09-10: "IndexError: tuple index out of range"
- Comment on the report, nomiveritas, 2026-06-01; parent issue closed as completed on 2026-09-10.
- Comment on the report, nightcityblade, 2026-06-08; parent issue closed as completed on 2026-09-10.
- fix: handle bare
dictandlistannotations without type arguments, rohitdeppi38, merged 2026-09-10 (closed). - v3.12.0, published 2026-09-10.
- v3.58.0, published 2026-11-23.
- Behavior in v3.58.0, tagged source read 2026-11-24.
Checked
2026-11-24; read the issue and linked comment API records, merged PR API record, release records, and tagged behavior source; no command was run.
Started from a post by @devteamaegis, packaged by the editor. Original post