You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SDK client times out after exactly 5 minutes on Node.js when using session.prompt() #15555
When using @opencode-ai/sdk on Node.js 22 (not Bun), any session.prompt() call that takes longer than 5 minutes fails with:
HeadersTimeoutError: Headers Timeout Error
at FastTimer.onParserTimeout [as _onTimeout] (node:internal/deps/undici/undici:7529:32)
at Timeout.onTick [as _onTimeout] (node:internal/deps/undici/undici:692:17)
This is undici's default headersTimeout of 300,000ms (5 minutes) on Node.js's built-in fetch().
We're using the SDK to orchestrate multi-step agent workflows (fix, lint, review, commit). Short-running prompts (< 5 min)
succeed. Long-running ones (e.g., lint verification via a subagent) fail at exactly 5 minutes every time.
The SDK already has a workaround in packages/sdk/js/src/v2/client.ts that sets req.timeout = false before calling fetch(). It seems this has no effect...
Steps to reproduce:
Use @opencode-ai/sdk on Node.js 22 (not Bun)
Call client.session.prompt() with a prompt that triggers agent work lasting > 5 minutes
The call fails at exactly 5 minutes with HeadersTimeoutError
OpenCode version: SDK @opencode-ai/sdk v1.1.4
Operating System: Linux (Node.js 22 Alpine container)
Activity
chengbofar commentedon Mar 4, 2026
I have the same issue
zhangzhi9410 commentedon Mar 13, 2026
I have the same issue
gf9276 commentedon Mar 18, 2026
I have the same question. Is opencode listening to input, causing the program to hang?
omriel1 commentedon Apr 13, 2026
Hi, I have the same issue. Do we have a proposed solution?
mwlik commentedon Apr 28, 2026
(@chengbofar, @zhangzhi9410, @gf9276, @omriel1) node's fetch seems to have some kind of 300s timeout (nodejs/node#46375), the quick fix for me was this (stackoverflow):
github-actions commentedon Jul 3, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.