Repository navigation
Description
Environment
- opencode
v2.0.28(npm-global@opencode/cli), darwin/arm64 - Plugin: local-directory plugin, registered via
plugins: ["/path/to/local-plugin"] - Plugin deps:
@opencode-ai/plugin0.0.0-beta-19135,effect4.0.0-rc.112 - Regression: the same plugin loaded fine on
v2.0.22
Summary
On 2.0.28, a V2 plugin that imports @opencode-ai/plugin/rpc fails to load with:
TypeError: Schema.isStartsWith is not a function.
(In 'Schema.isStartsWith("wrk")', 'Schema.isStartsWith' is undefined)
The throw happens at module-import time, so the plugin's setup() never runs. The plugin is simply unusable; /plugins only shows it as failed.
Where it throws
@opencode-ai/schema/dist/workspace-id.js:4 — top-level, evaluated on import:
import { Schema } from "effect";
export const WorkspaceID = Schema.String.check(Schema.isStartsWith("wrk")).pipe(...)Import chain for the failing plugin:
plugin entry
→ @opencode-ai/plugin/rpc
→ @opencode-ai/schema/rpc
→ schema/{workspace,workspace-event,location}.js
→ workspace-id.js ← throws here
Root cause
Schema.isStartsWith exists in effect 4.0.0-rc.112 but not in 4.0.0-rc.118 or 4.0.1:
| effect version | isStartsWith present in dist/ |
|---|---|
4.0.0-rc.112 |
yes |
4.0.0-rc.118 |
no |
4.0.1 |
no |
But the published @opencode-ai/schema builds still call it:
@opencode-ai/schema |
declares effect |
files calling isStartsWith |
|---|---|---|
0.0.0-beta-19135 |
4.0.0-rc.112 |
11 |
0.0.0-beta-19151 |
4.0.0-rc.112 |
11 |
0.0.0-beta-19271 (current beta dist-tag) |
4.0.0-rc.112 |
11 |
After #54198 moved the host to Effect 4.0.1, that export is gone from the Effect instance the plugin's modules are evaluated against, so Schema.isStartsWith is undefined and the import throws.
The same split is visible at the binary level:
$ strings <v2.0.22 binary> | grep -c isStartsWith
3
$ strings <v2.0.28 binary> | grep -c isStartsWith
0
Control experiment
Two local plugins with identical dependency sets (@opencode-ai/plugin: beta, same effect), loaded side by side:
| plugin | imports @opencode-ai/plugin/rpc |
loads on 2.0.28 |
|---|---|---|
| A | yes | fails |
| B | no | ok |
So this is specific to the /rpc surface (which pulls the workspace schemas), not to local-directory plugins in general.
Impact
Any V2 plugin using Rpc.define from @opencode-ai/plugin/rpc cannot load on 2.0.28. There is no plugin-side workaround: every currently published @opencode-ai/schema beta still calls the removed API, and the plugin's own pinned effect is not the instance that ends up being used.
Suggested fixes (any one would unblock)
- Keep
Schema.isStartsWithexported from the bundled Effect (a re-export shim is enough), or - Stop resolving bare
effectfrom the host for plugin-side modules, so a plugin's own pinnedeffectis used, or - Republish
@opencode-ai/schema/@opencode-ai/pluginagainst Effect 4.x — every current beta still pins4.0.0-rc.112.
Raw log
level=WARN message="failed to load plugin" target=/path/to/local-plugin ref=err_e6121439
cause="Cause([Die(TypeError: Schema.isStartsWith is not a function.
(In 'Schema.isStartsWith(\"wrk\")', 'Schema.isStartsWith' is undefined))])" role=server
Caveat
I could not inspect the host's internal module resolution (it is a compiled binary), so the exact mechanism by which the host's Effect instance reaches plugin-side modules is inferred rather than proven. The version comparisons above are measured directly from the published packages and the release binaries.
Activity
opencode-agent commentedon Oct 13, 2026
Thanks for the detailed report. I can reproduce this on 2.0.28, and it still happens on the latest
dev(1015cb67d).Steps: a local-directory plugin depending on
@opencode-ai/[email protected]and[email protected], registered viaplugins: ["/abs/path"]. On load, the server logsfailed to load plugin … TypeError: Schema.isStartsWith is not a function. The script below reproduces it.What I found:
effect(4.0.1), and that includes nested dependencies like@opencode-ai/schema. That part of your guess is right.Schema.isStartsWithtoSchema.isStartingWith, and OpenCode's own schema source already uses the new name. The@opencode-ai/*beta packages on npm are an older package scope and haven't been updated.@opencode-ai/plugin/rpcloaded fine for me. It failed once something led toworkspace-id.js, e.g. importingPlugin/Locationfrom the package root. So the exact chain may depend on what your plugin imports.Workaround: the current package for V2 plugins is
@opencode/plugin(version 2.0.28, same as the CLI). I rewrote the same plugin against it (PluginandLocationfrom@opencode/plugin,Rpcfrom@opencode/plugin/rpc), and it loads and runssetupon 2.0.28. Switching your dependency should unblock you.Maintainers will decide how to handle plugins that still use the old
@opencode-ai/*packages. Related: #53422 (plugins receive the host's Effect) and #54198 (Effect 4.0.1 upgrade).Reproduction script (repro.sh)
Run it:
bash repro.shrekram1-node commentedon Oct 15, 2026
The opencode-ai/plugin beta versions had an older version of effect, recommend using the stable v2 plugin versions instead
OpenCode V2 only: stable plugin API, cancel fix, HTTP/1.1 fallback (#1)