anomalyco / anomalyco/opencode

Regression: nested OpenAI Responses stream error handling from #36130 is missing

Open
#42,007 1 comment 0 reactions 1 assignee View on GitHub

@rekram1-node is already working on this.

Since Aug 12, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

The nested OpenAI Responses SSE error handling merged in #36130 is missing from current dev and the v1.18.16 release.

This causes intermittent OpenAI failures to lose their nested provider code/message and surface only as:

OpenAI Responses stream error
ProviderShared.stream: Failed to read openai/openai-responses stream

I encounter this in both new and long sessions, so it does not appear limited to context size.

#36130 added support for event-level errors shaped like:

{
  "type": "error",
  "error": {
    "type": "upstream_error",
    "code": "stream_read_error",
    "message": "..."
  }
}

Specifically, merge commit bd0dffd added:

error: optionalNull(OpenAIResponsesErrorPayload)

to OpenAIResponsesEvent, and extracted details with:

const nested = event.error ?? event.response?.error ?? undefined

The current source only accepts top-level code/message and response.error; it does not accept or read event.error. The regression tests added by #36130 are also absent.

I could not find an intentional revert. The merge commit and current dev have diverged histories (GitHub reports a June 26 merge base), suggesting the fix was lost during the V2 branch transition rather than deliberately removed.

Related: #34995 covers typed LLM errors generally. This report is the narrower regression where a previously merged wire format and its tests disappeared.

Plugins

A local llama.cpp autoload plugin is installed, but this occurs on the native OpenAI provider and the plugin does not modify it.

OpenCode version

1.18.16

Steps to reproduce

A deterministic parser-level reproduction is the regression test from #36130:

  1. Feed the OpenAI Responses route this SSE event:

    {"type":"error","sequence_number":2,"error":{"type":"invalid_request_error","code":"context_length_exceeded","message":"prompt too long","param":"input"}}
    
  2. Observe that current dev drops the nested details and emits the fallback OpenAI Responses stream error instead of context_length_exceeded: prompt too long with context-overflow classification.

In normal use, chat with an OpenAI Responses model. Intermittent upstream stream errors produce the two generic messages quoted above instead of preserving the provider error details.

Screenshot and/or share link

No response

Operating System

CachyOS, Linux 7.1.8-1-cachyos x86_64

Terminal

OpenCode web client; server runs as a systemd user service

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.