Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

IndexError in accumulate_event during Responses API streaming

Offen
#2,852 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

@Krishnachaitanyakc arbeitet bereits daran.

Seit 25.3.2026.

  • #1 von @bodapatisaikrishna — offen
  • #2942 von @MaxwellCalkin — ohne Merge geschlossen
  • #3010 von @Krishnachaitanyakc — offen

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
55/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Veraltet
Tech-Stack
python
Bereich
api

Rechercherichtung

Beginne mit dem Lesen von openai/lib/streaming/responses/_responses.py, insbesondere von accumulate_event in Zeile 344 und seinen Aufrufern handle_event und stream. Reproduziere den sporadisch auftretenden Fehler mit AsyncOpenAI().responses.stream() unter Verwendung des beschriebenen Responses API-Kontexts und verifiziere anschließend, dass Streaming und Fortsetzen mit starting_after ohne einen IndexError abgeschlossen werden.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Bug Report

Description

IndexError: list index out of range occurs inside the OpenAI SDK during streaming of Responses API events. The error originates in openai/lib/streaming/responses/_responses.py line 344 in accumulate_event, called from handle_event (line 248) and __stream__ (line 156).

This is not caused by application code — it happens internally within the SDK's stream accumulator.

Stack Trace
File "/app/.venv/lib/python3.13/site-packages/openai/lib/streaming/responses/_responses.py", line 151, in __aiter__
File "/app/.venv/lib/python3.13/site-packages/openai/lib/streaming/responses/_responses.py", line 156, in __stream__
File "/app/.venv/lib/python3.13/site-packages/openai/lib/streaming/responses/_responses.py", line 248, in handle_event
File "/app/.venv/lib/python3.13/site-packages/openai/lib/streaming/responses/_responses.py", line 344, in accumulate_event
    IndexError: list index out of range
Reproduction Context
  • SDK version: openai==2.16.0
  • Python version: 3.13
  • API: Responses API with streaming (stream=True)
  • Model: gpt-5-nano
  • Features used: tools=[{"type": "web_search"}], structured output with text_format (Pydantic model)
  • Streaming method: AsyncOpenAI().responses.stream() and resume via responses.stream() with starting_after
Code Pattern
async with client.responses.stream(...) as stream:
    async for event in stream:  # IndexError thrown here intermittently
        ...

The error occurs intermittently — most streams complete fine, but occasionally the accumulator hits an index that doesn't exist in its internal list.

Workaround

Wrapping the stream iteration in a try/except IndexError to catch and log the error, since the stream has typically delivered the important data by the time this occurs.

Notes

A similar class of bug exists in the Assistants API streaming path (_assistants.py in accumulate_event) — see #1736 and #1882. This issue is for the newer Responses API streaming path (responses/_responses.py).

Vorherrschende Sprache
Python
Sterne
31.9k
Forks
8k
Ø Merge
11 Std. 44 Min.
Gemergte PRs (30 T.)
166

Entwicklungsumgebung

In Codespaces öffnen

Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus openai/openai-python

Alle Issues in openai/openai-python

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.