You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For one, this is unexpected because the event listener seems to be triggering twice.
But based off these logs, it seems like the plugin itself is registering twice?
This appears to be related to a broader plugin event firing issue where events are being triggered multiple times instead of just once. Feel free to ignore if this is a different scenario.
I had this before and it seems that in the configuration it loads them twice, once for it being global config and once for the project local. If that is the case, you can use this trick to avoid loading the plugin twice:
letIS_MYPLUGIN_REGISTERED=false;exportconstMyplugin: Plugin=async({ client, directory })=>{// Prevent double-registration when plugin loads from both global + local configif(IS_MYPLUGIN_REGISTERED){return{};}IS_MYPLUGIN_REGISTERED=true;}
I think I'm doing this weird thing with Git worktrees for my OpenCode config which is perhaps causing this but I think I checked all viable configuration files and it is only loading it once... I don't have a subagent.
Edit: In addition, my plugin is only existent in my current worktree, so it shouldn't be registering twice because of that.
Would it make sense to make it by default only load a plugin once so that this doesn't happen? And then maybe add an explicit flag that allows loading multiple times?
Btw @arsham and @EvanZhouDev you can also fix it without updating opencode by just having one export for your plugin export const YourPlugin
either export default YourPlugin
Activity
github-actions commentedon Jan 1, 2026
This issue might be a duplicate of existing issues. Please check:
This appears to be related to a broader plugin event firing issue where events are being triggered multiple times instead of just once. Feel free to ignore if this is a different scenario.
arsham commentedon Jan 1, 2026
Check this in two places:
I had this before and it seems that in the configuration it loads them twice, once for it being global config and once for the project local. If that is the case, you can use this trick to avoid loading the plugin twice:
EvanZhouDev commentedon Jan 1, 2026
That's essentially what I ended up doing... but in my case I did check that my configuration only loads it once.
rekram1-node commentedon Jan 1, 2026
@EvanZhouDev could be happening if the session has a subagent? Subagent sessions also have idle events
EvanZhouDev commentedon Jan 1, 2026
I think I'm doing this weird thing with Git worktrees for my OpenCode config which is perhaps causing this but I think I checked all viable configuration files and it is only loading it once... I don't have a subagent.
Edit: In addition, my plugin is only existent in my current worktree, so it shouldn't be registering twice because of that.
Would it make sense to make it by default only load a plugin once so that this doesn't happen? And then maybe add an explicit flag that allows loading multiple times?
anomalyco#6596 Fixes duplicate plugin intialization if we have defaul…
ShpetimA commentedon Jan 3, 2026
@EvanZhouDev @rekram1-node I ran into the same issue while developing a plugin found the bug created pr feel free to check it out
ShpetimA commentedon Jan 4, 2026
Btw @arsham and @EvanZhouDev you can also fix it without updating opencode by just having one export for your plugin
export const YourPlugin
either
export default YourPlugin
if you have both this issue happens