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:
- Define any subagent that uses this model (JSON or markdown):
-
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-logs output:
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/@ai-sdk+provider-utils@3.0.20+.../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_APICallError is 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-logs or log files.
Related issues
OpenCode version
1.1.53
Operating System
macOS (Darwin 24.6.0)
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:
Steps to reproduce
opencode.jsonc: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:Expected behavior
Actual behavior
AI_APICallErroris logged but swallowed.--print-logsor log files.Related issues
OpenCode version
1.1.53
Operating System
macOS (Darwin 24.6.0)