OpenCode Desktop - Subagent spawning via client.session.prompt() fails with "JSON Parse error: Unexpected EOF" #8763

Closed
opened 2026-02-16 18:10:47 -05:00 by yindo · 4 comments
Owner

Originally created by @13640535881 on GitHub (Feb 7, 2026).

Originally assigned to: @adamdotdevin on GitHub.

Description

Original Report
Source: https://github.com/code-yeongyu/oh-my-opencode/issues/1527

Triage Conclusion by @code-yeongyu (oh-my-opencode author):

This is an OpenCode Desktop app issue, NOT an oh-my-opencode plugin issue.

Bug Description
When plugins attempt to spawn subagents through client.session.prompt(), OpenCode Desktop throws JSON Parse error: Unexpected EOF from within the SDK call. This affects all subagent types and prevents core plugin functionality from working.

Error:

JSON Parse error: Unexpected EOF
at (:0)
at parse (unknown)
at processTicksAndRejections (native:7:39)
Steps to Reproduce
Install oh-my-opencode plugin (v3.2.3+) on OpenCode Desktop
Configure any subagent (e.g., Momus):
{
"agents": {
"momus": {
"model": "openai/gpt-5.2",
"variant": "medium"
}
}
}
Invoke the subagent through plugin's delegate_task function
Error occurs immediately when client.session.prompt() is called
Expected Behavior
Subagent processes should spawn successfully and execute tasks, as they do in OpenCode CLI version.

Actual Behavior
The call to client.session.prompt() throws JSON Parse error: Unexpected EOF. The plugin correctly catches and handles this error, but the root cause is in OpenCode Desktop's internal response parsing.

Key Evidence from Plugin Code Review:

Plugin code does NOT use JSON.parse() - it directly accesses properties from client.session.messages()
Error is thrown INSIDE OpenCode SDK's client.session.prompt() call
Plugin has test coverage for this error (src/tools/delegate-task/tools.test.ts:1112)
Environment Information
Affected Versions:

OpenCode Desktop: 1.1.51 (and likely other Desktop versions)
OpenCode CLI: NOT affected (works fine per user reports)
oh-my-opencode: 3.2.3
Operating Systems:

macOS (confirmed)
Windows 11 (likely affected)
Doctor Output:

Installation
✓ OpenCode Installation → 1.1.51
✓ Plugin Registration → Registered (pinned: latest)

Configuration
✓ Configuration Validity → Valid JSON config
✓ Model Resolution → 10 agents, 8 categories (18 overrides), 2433 available

All systems operational with warnings.
Root Cause Analysis
Evidence Points:

Desktop vs CLI Difference: Multiple users report OpenCode CLI works fine - only Desktop throws this error
All Subagents Affected: Not specific to any agent - ANY subagent spawned via delegate_task fails on Desktop
Error Location: The error is thrown by OpenCode Desktop's internal SDK when parsing the response from client.session.prompt(), NOT in plugin code
Plugin Error Handling: The plugin correctly catches and handles this error, but cannot prevent it from occurring in OpenCode's SDK
Test Coverage Exists: Plugin has comprehensive tests for this scenario
Related Issues
In oh-my-opencode:

#1527 - Momus agent JSON Parse error (macOS, Desktop 1.1.51)
#683 - Librarian agent JSON Parse error (closed, same root cause)
In OpenCode:

#9950 - "[Desktop] - Error when attempting to launch multiple subagents"
#6573 - "Sessions hang indefinitely when Task tool spawns subagents"
Impact
Severity: High

Affected Functionality:

All subagent-based features in plugins
Multi-agent workflows
Background task execution
Parallel agent delegation
User Impact: All Desktop users using oh-my-opencode (29K+ GitHub stars)

Workaround
Use OpenCode CLI instead of Desktop until this bug is fixed.

Suggested Investigation Points
Desktop vs CLI IPC: What's different about subprocess communication between Desktop and CLI?
Response Parsing: Why does Desktop's client.session.prompt() receive malformed/empty responses?
Subprocess Lifecycle: Is the subagent process failing to start or communicate back?

Plugins

oh-my-opencode@3.2.3

OpenCode version

1.1.51/1.1.53

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

windows10/windows11/macOS

Terminal

No response

Originally created by @13640535881 on GitHub (Feb 7, 2026). Originally assigned to: @adamdotdevin on GitHub. ### Description Original Report Source: https://github.com/code-yeongyu/oh-my-opencode/issues/1527  Triage Conclusion by @code-yeongyu (oh-my-opencode author):  This is an OpenCode Desktop app issue, NOT an oh-my-opencode plugin issue.  Bug Description When plugins attempt to spawn subagents through client.session.prompt(), OpenCode Desktop throws JSON Parse error: Unexpected EOF from within the SDK call. This affects all subagent types and prevents core plugin functionality from working.  Error:  JSON Parse error: Unexpected EOF at (:0) at parse (unknown) at processTicksAndRejections (native:7:39) Steps to Reproduce Install oh-my-opencode plugin (v3.2.3+) on OpenCode Desktop Configure any subagent (e.g., Momus): { "agents": { "momus": { "model": "openai/gpt-5.2", "variant": "medium" } } } Invoke the subagent through plugin's delegate_task function Error occurs immediately when client.session.prompt() is called Expected Behavior Subagent processes should spawn successfully and execute tasks, as they do in OpenCode CLI version.  Actual Behavior The call to client.session.prompt() throws JSON Parse error: Unexpected EOF. The plugin correctly catches and handles this error, but the root cause is in OpenCode Desktop's internal response parsing.  Key Evidence from Plugin Code Review:  Plugin code does NOT use JSON.parse() - it directly accesses properties from client.session.messages() Error is thrown INSIDE OpenCode SDK's client.session.prompt() call Plugin has test coverage for this error (src/tools/delegate-task/tools.test.ts:1112) Environment Information Affected Versions:  OpenCode Desktop: 1.1.51 (and likely other Desktop versions) OpenCode CLI: NOT affected (works fine per user reports) oh-my-opencode: 3.2.3 Operating Systems:  macOS (confirmed) Windows 11 (likely affected) Doctor Output:  Installation ✓ OpenCode Installation → 1.1.51 ✓ Plugin Registration → Registered (pinned: latest)  Configuration ✓ Configuration Validity → Valid JSON config ✓ Model Resolution → 10 agents, 8 categories (18 overrides), 2433 available  All systems operational with warnings. Root Cause Analysis Evidence Points:  Desktop vs CLI Difference: Multiple users report OpenCode CLI works fine - only Desktop throws this error All Subagents Affected: Not specific to any agent - ANY subagent spawned via delegate_task fails on Desktop Error Location: The error is thrown by OpenCode Desktop's internal SDK when parsing the response from client.session.prompt(), NOT in plugin code Plugin Error Handling: The plugin correctly catches and handles this error, but cannot prevent it from occurring in OpenCode's SDK Test Coverage Exists: Plugin has comprehensive tests for this scenario Related Issues In oh-my-opencode:  #1527 - Momus agent JSON Parse error (macOS, Desktop 1.1.51) #683 - Librarian agent JSON Parse error (closed, same root cause) In OpenCode:  #9950 - "[Desktop] - Error when attempting to launch multiple subagents" #6573 - "Sessions hang indefinitely when Task tool spawns subagents" Impact Severity: High  Affected Functionality:  All subagent-based features in plugins Multi-agent workflows Background task execution Parallel agent delegation User Impact: All Desktop users using oh-my-opencode (29K+ GitHub stars)  Workaround Use OpenCode CLI instead of Desktop until this bug is fixed.  Suggested Investigation Points Desktop vs CLI IPC: What's different about subprocess communication between Desktop and CLI? Response Parsing: Why does Desktop's client.session.prompt() receive malformed/empty responses? Subprocess Lifecycle: Is the subagent process failing to start or communicate back? ### Plugins oh-my-opencode@3.2.3 ### OpenCode version 1.1.51/1.1.53 ### Steps to reproduce _No response_ ### Screenshot and/or share link _No response_ ### Operating System windows10/windows11/macOS ### Terminal _No response_
yindo added the bugweb labels 2026-02-16 18:10:47 -05:00
yindo closed this issue 2026-02-16 18:10:47 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Feb 7, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #9950: Error when attempting to launch multiple subagents - Desktop app also experiences validation errors when spawning subagents
  • #6573: Sessions hang indefinitely when Task tool spawns subagents via REST API - Both this and #12571 report subagent spawning failures with parse/response errors
  • #8528: Child sessions created via SDK don't execute prompts - Similar Desktop/SDK interaction issue where child sessions don't properly execute, related to v1.1.15+ regression

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Feb 7, 2026): This issue might be a duplicate of existing issues. Please check: - #9950: Error when attempting to launch multiple subagents - Desktop app also experiences validation errors when spawning subagents - #6573: Sessions hang indefinitely when Task tool spawns subagents via REST API - Both this and #12571 report subagent spawning failures with parse/response errors - #8528: Child sessions created via SDK don't execute prompts - Similar Desktop/SDK interaction issue where child sessions don't properly execute, related to v1.1.15+ regression Feel free to ignore if none of these address your specific case.
Author
Owner

@13640535881 commented on GitHub (Feb 7, 2026):

The author of "oh-my-opencode" believes the issue lies in the opencode itself. This problem persists, and it occurs on multiple company computers as well as personal computers at home in the desktop version. Please take it seriously.

@13640535881 commented on GitHub (Feb 7, 2026): The author of "oh-my-opencode" believes the issue lies in the opencode itself. This problem persists, and it occurs on multiple company computers as well as personal computers at home in the desktop version. Please take it seriously.
Author
Owner

@13640535881 commented on GitHub (Feb 7, 2026):

Today, I tested it on another computer and it worked again. opencode1.1.53 & oh-my-opencode3.2.4. It's strange. I'll look into it further

@13640535881 commented on GitHub (Feb 7, 2026): Today, I tested it on another computer and it worked again. opencode1.1.53 & oh-my-opencode3.2.4. It's strange. I'll look into it further
Author
Owner

@13640535881 commented on GitHub (Feb 8, 2026):

Confirmed: opencode1.1.53 & oh-my-opencode3.4.0 has been repaired and is functioning normally!Just update it.

@13640535881 commented on GitHub (Feb 8, 2026): Confirmed: opencode1.1.53 & oh-my-opencode3.4.0 has been repaired and is functioning normally!Just update it.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#8763