Repository navigation
Plugin syntax errors are handled poorly #4850
Description
Description
The Problem
Plugin syntax errors are handled poorly:
- Errors only show in stdout as raw JSON (not in UI)
- Error messages are unhelpful ("AggregateError: 2 errors" with no details)
- No indication in the UI that a plugin failed to load
- May crash with core dump in some cases
What Happened
While developing a plugin, a missing closing brace }; caused:
- First attempt: OpenCode crashed with segmentation fault (core dump)
- After restart: Same error now shows JSON to stdout, then OpenCode exits
- Result: Very difficult to debug - had to watch terminal output
The Syntax Error
File: session-logger-broken.ts
Line: 91
Error: Missing closing brace for object literal
const example = {
// ... properties
}, // ← Missing semicolon and closing brace here
examples.push(example); // ← This causes syntax errorWhat Should Happen
✅ Show error in the UI (toast notification or status bar)
✅ Display the actual syntax error with line number
✅ Show which plugin failed
✅ List loaded/failed plugins somewhere visible
✅ Never crash the main process
BUG_REPORT.md
session-logger-broken copy.ts.txt
OpenCode version
1.0.119
Steps to reproduce
- Create a plugin file
.opencode/plugin/session-logger-broken.ts - Copy the contents of the attached
session-logger-broken copy.ts.txtfile (contains syntax error - missing closing brace) - Start OpenCode with
opencodecommand - Current Result: JSON error printed to stdout, OpenCode exits
- To see the error: Check stdout/terminal output for JSON error message
- Previous Result (in same terminal window but different tab): OpenCode would crash with segmentation fault
See my comment below with a script that reliably causes opencode to dump core.
session-logger-broken copy.ts.txt
Screenshot and/or share link
No TUI ever appeared, I got this on stdout instead and opencode terminated:
{
"name": "UnknownError",
"data": {
"message": "AggregateError: 2 errors building "/home/alan/opencode-dspy/.opencode/plugin/session-logger-broken.ts"\n at requestFetch (native:1:11)\n at (native:11:43)\n at (native:11:37)\n at requestInstantiate (native:1:11)\n at requestSatisfyUtil (native:1:11)\n at requestSatisfy (native:1:11)\n at requestImportModule (native:2)\n at requestImportModule (native:1:17)\n at (src/plugin/index.ts:42:32)\n at processTicksAndRejections (native:7:39)"
}
}
Operating System
Ubuntu 22.04
Terminal
kitty
Activity
CodeReclaimers commentedon Nov 28, 2025
(with props to opencode for writing its own bug report)
github-actions commentedon Nov 28, 2025
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case.
CodeReclaimers commentedon Nov 28, 2025
This is at least a partial duplicate, but the initial behavior of opencode when I first ran with this plugin was to dump core (and FUBAR my terminal tab) so it seems like there's something more going on sometimes than just an exit with a JSON message.
CodeReclaimers commentedon Nov 28, 2025
I can reliably get a core dump with this plugin script when starting opencode from the directory opencode-dspy. Removing the script results in a successful opencode launch.
session-logger-severely-broken.ts.txt
rekram1-node commentedon Nov 28, 2025
ill check it out