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
[BUG] V1 tool errors silently swallowed by Effect.orDie - AI never sees error messages #31772
V1 tools (edit, write, apply_patch, shell, glob, grep, etc.) that throw errors during execution have those errors silently swallowed. The root cause is Effect.orDie in packages/opencode/src/tool/tool.ts:146 which converts all errors to defects. Defects bypass the normal error reporting path and are invisible to the AI model.
Impact
The AI never sees error messages from V1 tools. Instead of receiving a clear error like "File not found" or "Permission denied", the tool silently returns nothing or the session appears to hang. This causes the AI to retry failed operations without understanding why they failed.
Effect.orDie converts ALL errors to defects (unrecoverable crashes). The core registry (packages/core/src/tool/registry.ts:68) only catches LLM.ToolFailure errors, not defects. So V1 tool runtime errors propagate as defects and never reach the model as meaningful error messages.
Affected Tools
All V1 tools defined via Tool.define() in packages/opencode/src/tool/:
edit.ts (throws on file not found, oldString mismatch)
Confirmed that this affects task.ts (subtask tool) specifically with a secondary effect: orphaned subagent sessions that continue running after the error, causing double processing when the orchestrator retries. Filed as #31787 with detailed root cause chain (Effect.orDie → acquireUseRelease skips cleanup → orphaned session).
Activity
github-actions commentedon Jun 10, 2026
This issue might be a duplicate of existing issues. Please check:
Effect.orDieswallowing errors, specifically for task/subtask permission denialsEffect.diesquashes errors to a generic message (in read.ts TOCTOU detection)These may be related root causes or overlap with the behavior described here.
hmannekomimi-ctrl2 commentedon Jun 10, 2026
Confirmed that this affects task.ts (subtask tool) specifically with a secondary effect: orphaned subagent sessions that continue running after the error, causing double processing when the orchestrator retries. Filed as #31787 with detailed root cause chain (Effect.orDie → acquireUseRelease skips cleanup → orphaned session).