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
opencode run hangs forever on API errors (breaks CLI/automation integrations) #8203
When opencode run encounters an API error (e.g., 429 rate limit), it logs the error but never exits - it hangs indefinitely. This breaks any CLI tool or automation system that spawns opencode as a subprocess.
Reproduction
# With an expired/rate-limited account:
timeout 30 opencode run "what is 1+1"# Result: hangs for 30 seconds, exit code 124 (timeout)
Expected Behavior
opencode should fail fast with a non-zero exit code and clear error message:
Error: API rate limited (429). Please check your subscription status.
Exit code: 1
Actual Behavior
opencode logs the error internally but continues running forever:
ERROR service=llm error={"statusCode":429,...}
# Then hangs indefinitely - no exit, no output to user
Impact
This breaks integrations like zeroshot which spawn CLI tools as subprocesses:
// zeroshot spawns opencodeexec('opencode run "task"',(error,stdout)=>{// This callback NEVER fires because opencode never exits});
Workaround: We've added timeouts to our subprocess calls, but the real fix should be in opencode.
Environment
opencode version: 1.1.16
OS: Linux (Ubuntu 22.04)
Auth: OpenAI OAuth
Suggested Fix
In the error handling path, ensure the process exits with non-zero code:
if(response.status===429){console.error('Error: API rate limited. Check subscription status.');process.exit(1);// <-- Currently missing}
Or more generally: any unrecoverable API error should cause opencode run to exit, not hang.
Activity
github-actions commentedon Jan 13, 2026
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case.
fix: prevent infinite hang when provider CLI hangs (opencode 429 bug)
ucirello commentedon Jan 13, 2026
And a variant of this problem is when the LLM messes up a MCP tool call, it also doesn't return control the proper way.
feat: add timeout wrapper to prevent opencode from hanging
thdxr commentedon Mar 25, 2026
To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.