Description
When a plugin returns an auth key in its export (even an empty array auth: []), the TUI worker crashes on startup with:
{
"name": "UnknownError",
"data": {
"message": "Error: Expected string, got undefined\n at <anonymous> (/$bunfs/root/src/cli/cmd/tui/worker.js:40673:82)\n at <anonymous> (/$bunfs/root/src/cli/cmd/tui/worker.js:32469:22)\n at <anonymous> (/$bunfs/root/src/cli/cmd/tui/worker.js:40673:35)\n at <anonymous> (/$bunfs/root/src/cli/cmd/tui/worker.js:276732:45)\n at processTicksAndRejections (native:7:39)"
}
}
Steps to Reproduce
- Create a minimal plugin that returns
auth: []:
export async function MyPlugin({ directory, client }) {
return {
auth: [],
};
}
- Register the plugin in
opencode.json
- Run
opencode
- TUI crashes immediately after plugin loads
Expected Behavior
The TUI should start normally. An empty auth array should be a no-op.
Actual Behavior
Crash with Zod validation error Expected string, got undefined in the TUI worker.
Environment
- OpenCode version: 1.2.27
- OS: macOS (darwin arm64)
- Plugin: Custom plugin with auth hooks for OAuth account management
Workaround
Commenting out the auth key from the plugin export allows OpenCode to start. The auth hooks were working in a previous version (confirmed working before, exact version unknown).
Notes
This also affects plugins that return populated auth arrays with valid AuthHook objects. The crash occurs regardless of the auth hook content — even auth: [] triggers it.
Description
When a plugin returns an
authkey in its export (even an empty arrayauth: []), the TUI worker crashes on startup with:Steps to Reproduce
auth: []:opencode.jsonopencodeExpected Behavior
The TUI should start normally. An empty auth array should be a no-op.
Actual Behavior
Crash with Zod validation error
Expected string, got undefinedin the TUI worker.Environment
Workaround
Commenting out the
authkey from the plugin export allows OpenCode to start. The auth hooks were working in a previous version (confirmed working before, exact version unknown).Notes
This also affects plugins that return populated auth arrays with valid AuthHook objects. The crash occurs regardless of the auth hook content — even
auth: []triggers it.