Skip to content

Running Opencode prevents running any Bun commands in Bun projects #18064

@cream-hub

Description

@cream-hub

Description

Basically sometimes when I run opencode afterwards I can no longer use bun because this what I get as an output

❯ bun run dev
$ bun run scripts/generate-icon-manifest.ts

> build · claude-opus-4-6

Opencode it's injecting inself into all of my bun commands

This is what Opencode has to say about this issue

opencode is a terminal-based AI coding tool (similar to Claude Code). It needs to intercept and wrap bun and node calls made by the projects it manages — likely to inject instrumentation, capture output, or control the runtime environment.

The mechanism:
1. When opencode starts a session, it creates a temp directory like /tmp/bun-node-<hash>/
2. It places symlinks in that directory: bun -> opencode and node -> opencode
3. It prepends that temp directory to PATH when spawning subprocesses
4. When a subprocess calls bun or node, it hits the symlink, which actually runs opencode — opencode detects it was invoked as "bun" or "node" (via argv[0]), does whatever interception it needs, then delegates to the real binary
This is a common pattern called PATH shimming — tools like nvm, asdf, volta, and mise all do something similar.

Plugins

No response

OpenCode version

1.2.27

Steps to reproduce

  1. Run Opencode, it generates the shims
  2. Try running any Bun project
  3. You get greeted with Opencode stuff

Screenshot and/or share link

Image

Operating System

macOS

Terminal

Ghostty

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcoreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions