Skip to content

Unhandled AI_APICallError on transient GitHub Copilot API disconnect ("input item ID does not belong to this connection") #26886

Description

@sipa-echo-zaoa

Description

Summary

When using the GitHub Copilot provider, if the upstream api.githubcopilot.com backend drops the connection or gets out of sync (returning an input item ID does not belong to this connection error), OpenCode fails to catch it gracefully. Instead, it throws a raw AI_APICallError stack trace.

Since this appears to be a rare but known upstream API glitch, it would be great if OpenCode could catch this specific error and either automatically retry the request or surface a user-friendly UI message (e.g., "Connection to Copilot lost. Please try again.") rather than dumping the raw trace.

Expected Behavior

OpenCode handles the upstream stream error gracefully via automatic retry or a clean UI notification.

Actual Behavior

The application throws an unhandled exception from the internal session processor.

Logs / Traceback

Note: The requestBodyValues containing the codebase context have been redacted for security.

ERROR 2026-05-11T13:19:09 +1040ms service=llm providerID=github-copilot modelID=gpt-5.4 session.id=ses_2bbb04f7cffeQD0GtJEX7zbAI1 small=false agent=plan mode=primary error={"error":{"name":"AI_APICallError","url":"[https://api.githubcopilot.com/responses](https://api.githubcopilot.com/responses)","requestBodyValues": "[... TRUNCATED FOR SECURITY ...]"}}

responseBody: "{\"error\":{\"message\":\"input item ID does not belong to this connection\",\"code\":\"\"}}\n","isRetryable":false,"data":{"error":{"message":"input item ID does not belong to this connection","code":""}}}} stream error

ERROR 2026-05-11T13:19:09 +24ms service=session.processor session.id=ses_2bbb04f7cffeQD0GtJEX7zbAI1 messageID=msg_e1730fff1002Hv0sQTLdGtK4R6 error=input item ID does not belong to this connection stack=AI_APICallError: input item ID does not belong to this connection
    at <anonymous> (/$bunfs/root/chunk-2zmezpas.js:6:14583)
    at async <anonymous> (/$bunfs/root/chunk-2zmezpas.js:6:12790)
    at processTicksAndRejections (native:7:39) process

Related issue

This issue in the Copilot-cli seems similar to this one

Plugins

None

OpenCode version

1.14.48

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

Linux Mint 21.2

Terminal

Ghostty

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions