fix(cli): missing plugin deps cause TUI to black screen by elithrar · Pull Request #14432 · anomalyco/opencode
Issue for this PR
Closes #14433
Type of change
- Bug fix
- New feature
- Refactor / code improvement
- Documentation
What does this PR do?
When a plugin dependency can't be resolved (e.g. node_modules missing for @opencode-ai/plugin), the import() in plugin loading throws. State.create() caches the rejected promise, every subsequent API request fails, and the TUI stalls on a black screen indefinitely. In non-interactive mode (opencode run --print-logs) the error surfaces in logs, but TUI mode gives zero feedback.
- wrap
import(plugin)and plugin init in.catch()so a broken plugin is skipped instead of crashing the wholestate()initializer - catch internal plugin init failures (CodexAuth, CopilotAuth, GitlabAuth) with
.catch()+ log - unify builtin and non-builtin install failure handling — all install failures log, publish
Session.Event.Errorfor the TUI, and continue - extract the underlying
.causefromBunInstallFailedErrorso the user-facing message includes the real failure reason - log
bun installfailures inconfig.tsinstallDependenciesinstead of swallowing with.catch(() => {})
After the fix, a missing dependency shows as an error event in the TUI and in logs, and the app starts with remaining plugins.
How did you verify your code works?
tsc --noEmitpasses- manually tested with a plugin config pointing at a file:// plugin whose
@opencode-ai/plugindependency is missing — opencode now starts, shows the error in the session, and loads remaining plugins
Checklist
- I have tested my changes locally
- I have not included unrelated changes in this PR