Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

IndexError in accumulate_event during Responses API streaming

オープン
#2,852 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@Krishnachaitanyakc がすでに取り組んでいます。

2026年3月25日 から。

  • #1 @bodapatisaikrishna による — オープン
  • #2942 @MaxwellCalkin による — マージされずにクローズ
  • #3010 @Krishnachaitanyakc による — オープン

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
55/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
python
領域
api

調査の方向性

まず openai/lib/streaming/responses/_responses.py を読み、特に 344 行目の accumulate_event と、その呼び出し元である handle_event および stream を確認します。説明されている Responses API のコンテキストを使って AsyncOpenAI().responses.stream() で断続的な失敗を再現し、その後、starting_after を使ったストリーミングと再開が IndexError なしで完了することを確認します。

索引モデルが issue の本文から書いたものです。

説明

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).

主要言語
Python
スター
31.8k
フォーク
7.3k
平均マージ
1日 1時間
マージ済み PR(30日)
137

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

openai/openai-python のほかの issue

openai/openai-python の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。