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
- When the error
"SSE read timed out" is thrown, it gets converted to NamedError.Unknown in message-v2.ts:fromError()
- 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_
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
"SSE read timed out"is thrown, it gets converted toNamedError.Unknowninmessage-v2.ts:fromError()retry.ts:retryable(), this error is treated as non-retryable because:APICallErrorContextOverflowErrorretryable()function tries to parse it as JSON (JSON.parse("SSE read timed out")), which fails, sojsonbecomesundefined, and the function returnsundefined(non-retryable)Expected behavior:
Suggested fix:
Add a check in
retry.ts:retryable()to recognize SSE timeout errors: