Skip to content

[Windows/2.1.1] Local plugin stuck failing with ENOENT for existing file until service restart #57658

Closed as duplicate

Description

@dreamwayjgs

Summary

On Windows + OpenCode 2.1.1 (serve --service), a local plugin directory
kept failing to load with ENOENT for a file that exists and is readable,
across every reload trigger (config edit, file touch, dir replacement).
opencode service restart fixed it immediately; zero failures since.

Environment

  • Windows 11, OpenCode 2.1.1 (scoop install), background service
  • Local plugin at ~/.config/opencode/plugins/ponytail/ with
    package.json (type: module, main: index.js) + index.js +
    nested node_modules/@dietrichgebert/ponytail
  • opencode.json plugins: ["./plugins/caveman", "./plugins/ponytail"]

Error (server log, repeated for ~1h)

failed to load plugin target="C:\Users\anint\.config\opencode\plugins\ponytail"
cause="Cause([Die(Error: ENOENT: no such file or directory,
  open 'C:\Users\anint\.config\opencode\plugins\ponytail\node_modules\@dietrichgebert\ponytail\hooks\ponytail-instructions.js')])"

The sibling local plugin (caveman, flat files, no nested node_modules)
loaded fine the whole time.

Verified facts (not guesses)

  • The file exists and is readable: direct node readFileSync, and reads of
    the same path from inside a throwaway probe plugin loaded by the same
    server, all succeed.
  • node -e import(...) of the plugin entrypoint succeeds outside the server.
  • The installed index.js is byte-identical to the known-good source.
  • Failed under: config remove/re-add, file touch, full directory
    delete-and-atomic-replace, and a byte-identical copy under a fresh
    directory name (fresh path loaded ~3x, then started failing too after
    the watcher subscribed to its files).
  • After opencode service restart: both plugins load cleanly, no failures.

Suspected area (unconfirmed)

Looks like in-process loader state poisoned by an early sighting of the
plugin directory (it was created ~1min before node_modules finished
installing), never cleared by any reload trigger — or a watcher/hot-reload
interaction on Windows. Timelines correlate failures with watcher
subscribe events, but that correlation may be incidental.

Happy to provide the full server log excerpt or test a diagnostic build.

Activity

  1. opencode-agent commented on Oct 21, 2026

    @opencode-agent
    Contributor

    Thanks for the detailed report. I think this is a duplicate of #46095. There, on the Windows background service, a plugin that was loaded before its files had finished writing stays failed for the rest of the process. Touching the file, editing config and reloading all fail the same way, and only opencode service restart clears it. Your timeline matches that: the plugin directory existed about a minute before its nested node_modules finished installing, and only the restart fixed it.

    Possible duplicates and related issues, ordered by likelihood:

    Your finding that a copy under a fresh directory name also started failing would be useful to add on #46095.

    The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different.

  2. opencode-agent commented on Oct 22, 2026

    @opencode-agent
    Contributor

    We haven't heard back in the last day, so I'm closing this as a duplicate of #46095. That issue covers the same problem on the Windows background service: a plugin loaded before its files finish writing stays failed until opencode service restart. Please follow #46095 for updates. Your detail that a copy under a fresh directory name also started failing would be a useful comment there. If your problem turns out to be different, reply here and we can reopen this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions