[PR #13895] fix: pre-build custom tools instead of naively import()ing them #14860

Open
opened 2026-02-16 18:19:36 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/13895

State: open
Merged: No


on first launch, opencode installs @opencode-ai/plugin. but without restarting opencode when it's done, the following error appears:

error: Cannot find package 'zod' from '/home/demostanis/.config/opencode/node_modules/@opencode-ai/plugin/dist/tool.js'

https://opncd.ai/share/phMT4NGN (seems buggy? my messages don't show correctly)

This is a quick vibe-coded fix with Claude Opus 4.6.

What does this PR do?

(Fixes #13887)

OpenCode installs @opencode-ai/plugin on first start to ~/.config/opencode/node_modules. However,
when having custom tools in ~/.config/opencode/tools, an error appears on the TUI:
error: Cannot find package 'zod' from '/home/demostanis/.config/opencode/node_modules/@opencode-ai/plugin/dist/tool.js'
(or similar with @opencode-ai/plugin)
A restart is needed for the error to disappear.
This is impactful on temporary systems, where ~/.config/opencode/node_modules will be frequently suppressed (my system runs on a tmpfs)

How did you verify your code works?

rm -rf /home/demostanis/.config/opencode/node_modules && rm -rf /tmp/.opencode && rm -rf /tmp/a && mkdir -p /tmp/a && cd /tmp/a && timeout 120 /tmp/tmp.ILuulrHZEC/opencode/packages/opencode/dist/opencode-linux-x64/bin/opencode run "use the python tool with a hello world program" 2>&

(to adapt)

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/13895 **State:** open **Merged:** No --- on first launch, opencode installs @opencode-ai/plugin. but without restarting opencode when it's done, the following error appears: error: Cannot find package 'zod' from '/home/demostanis/.config/opencode/node_modules/@opencode-ai/plugin/dist/tool.js' https://opncd.ai/share/phMT4NGN (seems buggy? my messages don't show correctly) This is a quick vibe-coded fix with Claude Opus 4.6. ### What does this PR do? (Fixes #13887) OpenCode installs @opencode-ai/plugin on first start to ~/.config/opencode/node_modules. However, when having custom tools in ~/.config/opencode/tools, an error appears on the TUI: error: Cannot find package 'zod' from '/home/demostanis/.config/opencode/node_modules/@opencode-ai/plugin/dist/tool.js' (or similar with @opencode-ai/plugin) A restart is needed for the error to disappear. This is impactful on temporary systems, where ~/.config/opencode/node_modules will be frequently suppressed (my system runs on a tmpfs) ### How did you verify your code works? ``` rm -rf /home/demostanis/.config/opencode/node_modules && rm -rf /tmp/.opencode && rm -rf /tmp/a && mkdir -p /tmp/a && cd /tmp/a && timeout 120 /tmp/tmp.ILuulrHZEC/opencode/packages/opencode/dist/opencode-linux-x64/bin/opencode run "use the python tool with a hello world program" 2>& ``` (to adapt)
yindo added the pull-request label 2026-02-16 18:19:36 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#14860