Skip to content

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

@KingingWang

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_

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