Repository navigation
Closed
Description
Description
When a subagent encounters an AI_APICallError (e.g., due to an invalid model ID), the error is logged at ERROR level but never surfaced to the user or returned to the parent agent as a tool result. The subagent session silently dies, and the parent session appears stuck/loading indefinitely.
By contrast, when a primary agent hits the same error, it is surfaced clearly in the TUI:
Error: model: claude-sonnet-4-5-latest
Steps to reproduce
- Configure a custom model alias with an invalid model ID in
opencode.jsonc:
"provider": {
"anthropic": {
"models": {
"sonnet": { "id": "claude-sonnet-4-5-INVALID" }
}
}
}- Define any subagent that uses this model (JSON or markdown):
"agent": {
"my-agent": {
"description": "Test agent",
"mode": "subagent",
"model": "anthropic/sonnet"
}
}-
In a session, have the primary agent invoke the subagent via the task tool.
-
The subagent's LLM call fails with
AI_APICallError. The error appears in--print-logsoutput:
ERROR service=session.processor error=model: claude-sonnet-4-5-INVALID stack="AI_APICallError: model: claude-sonnet-4-5-INVALID\n at <anonymous> (../../node_modules/.bun/@[email protected]+.../dist/index.mjs:936:18)..."
- But the parent session never receives the error — it just hangs waiting for the subagent.
Expected behavior
- The error should be returned to the parent agent as a failed tool result, so it can report the issue or attempt recovery.
- The TUI should surface the subagent error to the user (e.g., in the subagent panel or as a notification).
Actual behavior
- The
AI_APICallErroris logged but swallowed. - The subagent session silently dies.
- The parent session hangs indefinitely waiting for a response that will never come.
- The user has no indication of what went wrong without checking
--print-logsor log files.
Related issues
- Tasks/Subagents with Codex / OpenAI are frequently getting stuck with no timeout/retry, which then hangs the session forever #11865 — subagents getting stuck with no timeout/retry (different provider, similar symptom)
- TUI: Parent session appears stuck "loading" when subagent is blocked (waiting user input / hanging tool call); lack of visibility and recovery UX #10802 — parent session appears stuck when subagent is blocked (TUI visibility)
OpenCode version
1.1.53
Operating System
macOS (Darwin 24.6.0)
Metadata
Metadata
Assignees
Labels
No labels
Activity
fix(opencode): propagate subagent errors to parent session
github-actions commentedon Apr 14, 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.