Repository navigation
Description
Summary
When a local plugin file under ~/.config/opencode/plugins/ is edited while the background service is running, the plugin hot-reload fails with a TypeError and all config-defined providers are wiped from the provider registry until the service is restarted. In our setup this silently breaks an auth-bridge provider (requests bypass its configured baseURL and hit the upstream API directly with an invalid credential).
Environment
- opencode version: 2.0.24 (channel: latest, npm
@opencode/cli) - OS: Debian 12, Linux 6.1.0-53-amd64 x86_64
- Terminal: rxvt-unicode-256color (urxvtd daemon)
- Shell: /bin/bash
- Install/channel: latest release
- Active plugins:
- npm:
[email protected],[email protected] - local:
~/.config/opencode/plugins/rtk.ts,~/.config/opencode/plugins/llm-rate/(directory plugin:index.tsserver half +tui.tsxTUI half importing@opencode/plugin/tui)
- npm:
Reproduction
Observed 4 times consistently (4/4) today; exact steps from our setup:
-
Run OpenCode (persistent background service,
opencode serve --service) with a config that defines providers in theprovidersblock, e.g. one custom provider withpackage+settings.baseURLpointing at a local auth bridge, plus another custom provider. -
With TUI sessions active, save any file in the local plugin directory (
index.tsor the siblingtui.tsx) — even a valid, compiling change. -
The log shows repeated errors:
level=ERROR message="failed to reload plugins" cause="Cause([Die(TypeError: oe is not a function. (In 'oe()', 'oe' is an instance of Object))])" -
Query the provider registry from a new CLI context:
opencode api provider.list
Config-defined providers are gone — only built-in discovery entries remain (
anthropic,openrouter,opencode), and theanthropicentry has nosettings(nobaseURL, noapiKey). -
Requests through the affected provider now bypass its configured
baseURL(our auth bridge on127.0.0.1:8787) and go directly to the upstream API, failing withAPI key is invalid. -
Killing the
opencode serve --serviceprocess and relaunching restores all providers (config is correct; nothing else changed).
Expected Behavior
- The plugin hot-reload either succeeds or fails without mutating the provider registry.
- Config-defined providers (and their
settings) survive a failed plugin reload.
Actual Behavior
- Plugin reload throws
TypeError: oe is not a function. (In 'oe()', 'oe' is an instance of Object)(minified). - The provider registry loses every config-defined provider until the service is restarted; only restart restores them.
Additional Context
- Frequency: consistent — 4 distinct incidents on the same day (~10:01, 10:38, 10:53, 11:03 UTC), 29
failed to reload pluginserror lines in the log. - Trigger was saving an edit to the plugin directory; the edited file always compiled cleanly (validated with esbuild beforehand in later incidents).
- Tried: making the TUI-half file export an inert plugin object when the TUI runtime is absent (guessing the server-side reload also imports it and throws on
Plugin.define) — did not help; the wipe still occurred. We could not isolate whether theTypeErrorcomes from our plugin code or the reload path itself (minified bundle). - Impact detail: the wipe is sticky. The plugin code itself may successfully hot-reload on a later save while providers stay missing, which makes the failure confusing (widget updated, sessions broken).
- Diagnostic note:
provider.listoutput from a transient CLI-spawned context can differ from the running service; the wipe was confirmed on the running service by observing requests bypass the configuredbaseURL(connection-level check viass -tnp). - Workaround: batch plugin edits and restart the background service after every edit.
Activity
github-actions commentedon Oct 6, 2026
This issue does not fully meet our contributing guidelines.
What needs to be fixed:
Please edit this issue to address the above within 72 hours, or it will be automatically closed.
This issue might be a duplicate of an existing issue. Please check:
If you believe this was flagged incorrectly, please let a maintainer know.
github-actions commentedon Oct 9, 2026
This issue has been automatically closed because it was not updated to meet our contributing guidelines within the 72-hour window.
Feel free to open a new issue that follows our issue templates.