anomalyco / anomalyco/opencode

v2 service crash-loops on EPIPE when a local MCP command dies instantly

Open
#43,257 1 comment 0 reactions 1 assignee View on GitHub

@nexxeln is already working on this.

Since Aug 18, 2026.

2.0
Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

If a local MCP server in config points at a command that exits immediately (in my case a bun run --cwd <dir that no longer exists> start entry), the v2 background service crashes on startup with an uncaught EPIPE: broken pipe, send. The client keeps respawning it, so the TUI is stuck showing "restarting service" forever and v2 is unusable until the MCP entry is removed by hand.

The EPIPE comes from flushing the MCP initialize frame into the dead child's stdin. It surfaces asynchronously through the stream's destroy path after the stdin sink has already completed, so nothing is listening for the error event on proc.stdin and it takes down the whole process:

EPIPE: broken pipe, send
 syscall: "send",
   errno: -32,
    code: "EPIPE"

      at end (unknown:1:1)
      at internal:fs/streams:402:23
      at _destroy (internal:streams/destroy:63:18)
      ...

Reproduces on the Bun 1.4 runtime that the v2 binary ships with; Bun 1.3.14 doesn't surface the late EPIPE.

Plugins

No response

OpenCode version

v0.0.0-beta-17595

Steps to reproduce
  1. Add a local MCP server whose command dies instantly, e.g. "command": ["bun", "run", "--cwd", "/nonexistent/dir", "start"]
  2. Launch the v2 TUI
  3. Service exits 1 with the EPIPE above; TUI loops on "restarting service"
Screenshot and/or share link

No response

Operating System

macOS 26

Terminal

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.