-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Open
Labels
opentuiThis relates to changes in v1.0, now that opencode uses opentuiThis relates to changes in v1.0, now that opencode uses opentui
Description
Description
Plugin event handlers registered via the plugin system can corrupt the TUI display when they throw errors or write to stderr.
Steps to Reproduce
- Create a plugin with an
eventhandler that either:- Throws an error (sync or async)
- Calls
console.error()to log failures
- Trigger the event (e.g.,
session.idle) - Observe the error output rendered directly into the TUI chat window
Expected Behavior
- Plugin event handler errors should be caught and logged to the OpenCode log file
- Plugins should have access to a proper logging mechanism instead of relying on
console.error() - A failing plugin should not prevent other plugins from receiving events
Actual Behavior
- Sync throws propagate up and crash the bus subscriber
- Async rejections are completely uncaught (handlers aren't
awaited) console.error()output goes to stderr, which corrupts the TUI display
Root Cause
In packages/opencode/src/plugin/index.ts, the Bus.subscribeAll callback calls hook["event"]?.() without:
awaiting the result (so async errors are uncaught)- Wrapping in try-catch (so sync errors propagate)
Additionally, plugins have no log property on PluginInput, so their only logging option is console.error() which writes to stderr.
Example occurance:

Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
opentuiThis relates to changes in v1.0, now that opencode uses opentuiThis relates to changes in v1.0, now that opencode uses opentui