[Bug]: OpenCode fails to Open with Plugin Installed, Instead Spams Terminal with Random Strings
Description
Bare minimum opencode.json:
{
"plugin": [
"opencode-pty"
],
"$schema": "https://opencode.ai/config.json"
}
Causes terminal to spew out random strings:
Reproduction Steps
Steps to reproduce the behavior:
- Configure plugin in opencode.json
- Run opencode
- See error
Expected Behavior
Expected to just see OpenCode open normally.
Actual Behavior
Environment
- OS: MacOS 26.0
- OpenCode Version: 1.1.3
- Plugin Version: 0.1.1
- Bun Version: 1.3.5
OpenCode Configuration
opencode.json (sanitized)
{
"plugin": [
"opencode-pty"
],
"$schema": "https://opencode.ai/config.json"
}
Debug Logs
Click to expand debug logs
To get debug logs, run OpenCode with debug logging enabled:
opencode --log-level DEBUG --print-logs
Or check log files in ~/.local/share/opencode/logs/.
INFO 2026-01-05T22:46:18 +130ms service=server method=GET path=/session request
INFO 2026-01-05T22:46:18 +0ms service=server status=started method=GET path=/session request
INFO 2026-01-05T22:46:18 +1ms service=default directory=/Users/evan/.local/share/opencode/log creating instance
INFO 2026-01-05T22:46:18 +0ms service=project directory=/Users/evan/.local/share/opencode/log froERROR 2026-01-05T22:46:18 +385ms service=default [object ErrorEvent]
ath=/config/providers request
INFO 2026-01-05T22:46:18 +0ms service=server status=started method=GET path=/config/providers request
INFO 2026-01-05T22:46:18 +0ms service=server method=GET path=/provider request
INFO 2026-01-05T22:46:18 +0ms service=server status=started method=GET path=/provider request
INFO 2026-01-05T22:46:18 +0ms service=server method=GET path=/agent request
INFO 2026-01-05T22:46:18 +0ms service=server status=started method=GET path=/agent request
INFO 2026-01-05T22:46:18 +0ms service=server method=GET path=/config request
INFO 2026-01-05T22:46:18 +0ms service=server status=started method=GET path=/config request
INFO 2026-01-05T22:46:18 +0ms service=server method=GET path=/event request
INFO 2026-01-05T22:46:18 +0ms service=server status=started method=GET path=/event request
INFO 2026-01-05T22:46:18 +3ms service=default directory=/Users/evan/.local/share/opencode/log bootstrapping
INFO 2026-01-05T22:46:18 +2ms service=config path=/Users/evan/.config/opencode/config.json loading
INFO 2026-01-05T22:46:18 +1ms service=config path=/Users/evan/.config/opencode/opencode.json loading
INFO 2026-01-05T22:46:18 +4ms service=config path=/Users/evan/.config/opencode/opencode.jsonc loading
INFO 2026-01-05T22:46:18 +2ms service=bun cmd=["/Users/evan/.bun/install/global/node_modules/opencode-darwin-arm64/bin/opencode","add","@opencode-ai/[email protected]","--exact"] cwd=/Users/evan/.config/opencode running
INFO 2026-01-05T22:46:18 +6ms service=plugin [email protected] loading plugin
Additional Context
The logs end abruptly where shared. No further logs are available.
I used this plugin (presumably an earlier version) on another device and it seems to work. I am setting this up on an alternate device and now it is breaking. OpenCode starts up normally with plugin removed, so I have pinned it down to this plugin as the issue.
Highly useful plugin, but unfortunate that it breaks in this case.
Can you try the following:
opencode serve --log-level DEBUG --port 4096 --hostname 127.0.0.1 --print-logs
And in another terminal run
opencode attach http://localhost:4096
Then see the issue and if the app is crashing and share the full logs, because I'm using macos mainly and never faced a similar issue.
Interesting... it seems to be throwing this:
error: Cannot find module '@opencode-ai/plugin' from '/Users/evan/.cache/opencode/node_modules/opencode-pty/src/plugin/pty/tools/spawn.ts'
Almost completely sure this is an issue on my side looking at that, will try to debug and see if I can fix. Weird error though, wonder why the modules aren't resolving.
The strangest thing, it seems that the dependencies were not resolving correctly for this plugin specifically. I tried to delete all cache for opencode and reopen it but I still get a similar error, this time for bun-pty.
I manually cd'd into the directory and bun i'd. That fixed it. Not too sure re: the root cause though.
The strangest thing, it seems that the dependencies were not resolving correctly for this plugin specifically. I tried to delete all cache for
opencodeand reopen it but I still get a similar error, this time forbun-pty. I manuallycd'd into the directory andbun i'd. That fixed it. Not too sure re: the root cause though.
is it because '@opencode-ai/plugin' is in dev deps instead of being in deps? could be a bug in opencode.
~~However, the second time I clean-installed it (purged cache) it throws for bun-pty, not @opencode-ai/plugin, which I checked is in deps~~
Edit: It seems that @opencode-ai/plugin being in dev deps might be the issue. Referring to the package.json of Oh My Opencode (https://github.com/code-yeongyu/oh-my-opencode/blob/dev/package.json), they do put it in dependencies.
yeah. will fix and publish a new version.
Appreciate it, thanks for developing this plugin 😄
Done, try https://github.com/shekohex/opencode-pty/releases/tag/v0.1.2
Let me know if this still an issue.
That was fast! Working great now.