litellm - 💡(How to fix) Fix [Bug]: github_copilot /v1/responses streaming breaks Vercel AI SDK with "reasoning part <id> not found" / "text part <id> not found"

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

TypeError: Cannot read properties of undefined (reading 'summaryParts')

Root Cause

GitHub Copilot's native /responses stream tags every event that belongs to a single output item with a different item_id. For one reasoning item, the ids on response.output_item.added, response.reasoning_summary_part.added, every response.reasoning_summary_text.delta, and response.output_item.done are all distinct (each is a fresh ~400-char encrypted blob). LiteLLM passes these through unchanged.

The OpenAI Responses spec (and OpenAI's real servers) emit the same item_id for all events of one output item. The AI SDK relies on this: it registers a part on *.part.added keyed by item_id, then looks up that key on each delta. Because Copilot's delta item_id was never registered (it differs from the part.added id), the lookup misses and the SDK errors. The :0 suffix is the AI SDK's summary_index.

Code Example

reasoning part <id>:0 not found

---

TypeError: Cannot read properties of undefined (reading 'summaryParts')

---

response.output_item.added    item.id : 2WHdL3EB25i3YV…Ug==
reasoning_summary_part.added  item_id : NPHXyerEbOlj10…7g==     <- differs from output_item.added
reasoning_summary_text.delta  item_id : 85 events, 85 DISTINCT ids   <- every delta has a new id
  Q7hVs/3cv4qes4…zA==
  xRnQv6VNiQsMvU…QA==
  C2+A7sgQB/RFXQ…lQ==

part.added id == output_item.added id ?  False
all delta ids == output_item.added id ?  False

---

REPRODUCED: reasoning part <COPILOT_ENCRYPTED_ID>:0 not found

---

model_list:
  - model_name: github_copilot/gpt-5.5
    litellm_params:
      model: github_copilot/gpt-5.5
    model_info:
      mode: responses

general_settings:
  master_key: sk-1234

litellm_settings:
  drop_params: True

---

{
  "name": "litellm-copilot-reasoning-repro",
  "private": true,
  "type": "module",
  "dependencies": {
    "@ai-sdk/openai": "^2.0.0",
    "ai": "^5.0.0",
    "tsx": "^4.19.0"
  }
}

---

import { createOpenAI } from '@ai-sdk/openai';
import { streamText } from 'ai';

const litellm = createOpenAI({
  baseURL: `${process.env.LITELLM_BASE_URL ?? 'http://localhost:4000'}/v1`,
  apiKey: process.env.LITELLM_API_KEY ?? 'sk-1234',
});

const result = streamText({
  model: litellm.responses(process.env.LITELLM_MODEL ?? 'github_copilot/gpt-5.5'),
  providerOptions: { openai: { reasoningSummary: 'detailed', store: false } },
  prompt: 'Reason step by step about why the sky is blue, then answer in one sentence.',
});

for await (const part of result.fullStream) {
  if (part.type === 'error') {
    console.error('REPRODUCED:', part.error);
    process.exit(1);
  }
}
console.log('OK: stream completed with no error parts.');

---

npm install
LITELLM_BASE_URL=http://localhost:4000 LITELLM_API_KEY=sk-1234 npx tsx repro.ts

---

REPRODUCED: reasoning part <COPILOT_ENCRYPTED_ID>:0 not found
RAW_BUFFERClick to expand / collapse

What happened?

When a github_copilot/* model is called through LiteLLM's Responses API (POST /v1/responses) with streaming, the Vercel AI SDK (ai / @ai-sdk/openai, used by OpenCode SDK and other agent frameworks) crashes mid-stream with:

reasoning part <id>:0 not found

and, once the reasoning block is dropped, the SDK then throws:

TypeError: Cannot read properties of undefined (reading 'summaryParts')

The same failure also occurs for assistant message text as text part <id> not found.

This makes github_copilot Responses-API models effectively unusable for streaming through any AI-SDK-based client (agentic tool-calling loops fail immediately on the second step).

Root cause

GitHub Copilot's native /responses stream tags every event that belongs to a single output item with a different item_id. For one reasoning item, the ids on response.output_item.added, response.reasoning_summary_part.added, every response.reasoning_summary_text.delta, and response.output_item.done are all distinct (each is a fresh ~400-char encrypted blob). LiteLLM passes these through unchanged.

The OpenAI Responses spec (and OpenAI's real servers) emit the same item_id for all events of one output item. The AI SDK relies on this: it registers a part on *.part.added keyed by item_id, then looks up that key on each delta. Because Copilot's delta item_id was never registered (it differs from the part.added id), the lookup misses and the SDK errors. The :0 suffix is the AI SDK's summary_index.

Evidence (raw SSE from POST /v1/responses, ids shortened)

response.output_item.added    item.id : 2WHdL3EB25i3YV…Ug==
reasoning_summary_part.added  item_id : NPHXyerEbOlj10…7g==     <- differs from output_item.added
reasoning_summary_text.delta  item_id : 85 events, 85 DISTINCT ids   <- every delta has a new id
  Q7hVs/3cv4qes4…zA==
  xRnQv6VNiQsMvU…QA==
  C2+A7sgQB/RFXQ…lQ==

part.added id == output_item.added id ?  False
all delta ids == output_item.added id ?  False

The same per-event id variance happens for assistant message items (response.content_part.added / response.output_text.delta all differ from the message output_item.added id), which is why the text path fails with text part <id> not found.

Relevant log output

REPRODUCED: reasoning part <COPILOT_ENCRYPTED_ID>:0 not found

(With [email protected], the same condition is thrown as TypeError: Cannot read properties of undefined (reading 'summaryParts').)

How to reproduce

LiteLLM config (config.yaml)

model_list:
  - model_name: github_copilot/gpt-5.5
    litellm_params:
      model: github_copilot/gpt-5.5
    model_info:
      mode: responses

general_settings:
  master_key: sk-1234

litellm_settings:
  drop_params: True

Start the proxy: litellm --config config.yaml --port 4000 (and complete the github_copilot OAuth device-flow login on first run).

Reproduction client (TypeScript, real Vercel AI SDK)

package.json:

{
  "name": "litellm-copilot-reasoning-repro",
  "private": true,
  "type": "module",
  "dependencies": {
    "@ai-sdk/openai": "^2.0.0",
    "ai": "^5.0.0",
    "tsx": "^4.19.0"
  }
}

repro.ts:

import { createOpenAI } from '@ai-sdk/openai';
import { streamText } from 'ai';

const litellm = createOpenAI({
  baseURL: `${process.env.LITELLM_BASE_URL ?? 'http://localhost:4000'}/v1`,
  apiKey: process.env.LITELLM_API_KEY ?? 'sk-1234',
});

const result = streamText({
  model: litellm.responses(process.env.LITELLM_MODEL ?? 'github_copilot/gpt-5.5'),
  providerOptions: { openai: { reasoningSummary: 'detailed', store: false } },
  prompt: 'Reason step by step about why the sky is blue, then answer in one sentence.',
});

for await (const part of result.fullStream) {
  if (part.type === 'error') {
    console.error('REPRODUCED:', part.error);
    process.exit(1);
  }
}
console.log('OK: stream completed with no error parts.');

Run:

npm install
LITELLM_BASE_URL=http://localhost:4000 LITELLM_API_KEY=sk-1234 npx tsx repro.ts

Expected: the stream completes and prints OK: stream completed with no error parts.

Actual:

REPRODUCED: reasoning part <COPILOT_ENCRYPTED_ID>:0 not found

With [email protected] the same condition surfaces as a thrown TypeError: Cannot read properties of undefined (reading 'summaryParts'). In an agentic loop the assistant output for the step is silently dropped.

Notes / scope

  • This is specific to the github_copilot provider on /v1/responses streaming — it stems from Copilot's upstream stream assigning a fresh item_id to every per-item event. Native OpenAI/Azure Responses streams use a single stable id per item and are unaffected.
  • A direct (non-AI-SDK) curl stream "succeeds" because raw consumers don't enforce the part-registration lifecycle; the breakage only surfaces with spec-strict clients like the AI SDK.
  • Issue #25336 reports a similar-looking item_id mismatch for Gemini Responses streaming, and #26529 reports the sibling text part <id> not found on the chat-completions path for Claude. Those are different providers/paths with different root causes; this report is scoped to github_copilot /v1/responses.

Relevant code

  • litellm/responses/streaming_iterator.pyResponsesAPIStreamingIterator._process_chunk calls responses_api_provider_config.transform_streaming_response(...) per chunk.
  • litellm/llms/github_copilot/responses/transformation.pyGithubCopilotResponsesAPIConfig inherits transform_streaming_response from OpenAIResponsesAPIConfig and does not normalize the per-event item_id.

Are you a ML Ops Team?

No

Twitter / LinkedIn details

No response


Environment

  • LiteLLM version: 1.89.0 (repro on litellm_internal_staging @ 51ba6e39cd)
  • Provider: github_copilot (endpoint https://api.enterprise.githubcopilot.com), model gpt-5.5, mode: responses
  • Endpoint: POST /v1/responses, stream: true, store: false, include: ["reasoning.encrypted_content"]
  • Client: [email protected] + @ai-sdk/[email protected] (also reproduces with [email protected], which surfaces it as reasoning part <id> not found rather than the summaryParts TypeError)

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING