Skip to content

SSE timeout errors are not retried when chunkTimeout is exceeded #20466

Closed

Description

@KingingWang

Description

When chunkTimeout is set in provider config and the LLM stops sending tokens for longer than the timeout (e.g., 60 seconds), an error "SSE read timed out" is thrown. However, this error is not retried by the session retry mechanism.

Plugins

No response

OpenCode version

latest

Steps to reproduce

  1. When the error "SSE read timed out" is thrown, it gets converted to NamedError.Unknown in message-v2.ts:fromError()
  2. In retry.ts:retryable(), this error is treated as non-retryable because:
    • It's not an APICallError
    • It's not a ContextOverflowError
    • The retryable() function tries to parse it as JSON (JSON.parse("SSE read timed out")), which fails, so json becomes undefined, and the function returns undefined (non-retryable)

Expected behavior:

  • SSE timeout errors should be treated as retryable network errors
  • The session should automatically retry when chunkTimeout is exceeded

Suggested fix:
Add a check in retry.ts:retryable() to recognize SSE timeout errors:

if (error.data.message?.includes("SSE read timed out")) {
  return "SSE read timed out"
}
Additional context:

This affects any provider using chunkTimeout configuration
Users with custom providers that sometimes have long think times are affected
No current workaround except removing chunkTimeout which can cause the session to hang indefinitely

### Screenshot and/or share link

_No response_

### Operating System

_No response_

### Terminal

_No response_

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Apr 1, 2026
  2. github-actions commented on Apr 1, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

  3. adamskrodzki commented on Apr 28, 2026

    @adamskrodzki
  4. removed
    bugSomething isn't working
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  5. added a commit that references this issue on Jun 30, 2026
    30eaad1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions