GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Hot plugin reload destroys the shared agent/skill registry for all locations (TypeError: o is not a function) · Issue #59443 · anomalyco/opencode

Hot plugin reload destroys the shared agent/skill registry for all locations (TypeError: o is not a function) #59443

New issue
Copy link
New issue
Copy link
Closed as duplicate
Closed as duplicate
Hot plugin reload destroys the shared agent/skill registry for all locations (TypeError: o is not a function)#59443
Copy link
Labels
pending closetriaging

Description

@fakekun420-ui
fakekun420-ui
opened on Oct 26, 2026
Issue body actions

Summary

On 2.1.4, a hot plugin reload caused by a filesystem change under a path declared in plugins[] throws
TypeError: o is not a function and does not fail only that plugin: it tears down the shared registry of
agents/skills/tools for every booted location. In-flight turns then die with AgentNotFoundError and
permission.rejected.

Environment

  • opencode 2.1.4 (@opencode/[email protected]; npm dist-tags.latest = 2.1.4 at the time of writing)
  • Linux 4.19 aarch64 (Ubuntu 24.04 chroot on Android), node v20.20.2, bun 1.4.4
  • one service on 127.0.0.1:49374 (opencode serve --service), 6 booted locations
  • config declares two external plugin directories ("plugins": ["/abs/pluginA", "/abs/pluginB"])

Symptoms

ERROR failed to reload plugins  cause="Cause([Die(TypeError: o is not a function. (In 'o()', 'o' is an instance of Object))])"
ERROR Failed to drain Session   cause="Session.AgentNotFoundError: Agent not found: \"orquestador\""

Tool calls that were in flight are rejected:

{"error":{"type":"permission.rejected","message":"Permission denied: shell"}}

Registry before/after the event:

  • GET /api/skill → 74, then 2
  • opencode debug agents → 14, then 7 (builtins only)
  • the same for every location, and it does not recover on its own

Repro A — a declared plugin directory disappears while the server runs

  1. config: "plugins": ["/abs/plugin"] (a directory containing index.js)
  2. boot a location: GET /api/agent?directory=/tmp/proj
  3. mv /abs/plugin /abs/plugin.old
  4. in the same second the log shows:
WARN  failed to load plugin  target=/abs/plugin  cause="... ENOENT: no such file or directory ..."
ERROR failed to reload plugins  TypeError: o is not a function
ERROR Failed to drain Session   Agent not found: "<agent>"

Writing a file inside that directory produces the same result: the reload path is entered either way.

Repro B — reload with a booted location

  1. start opencode serve --port 49998 with a config whose plugins[] lists a path that cannot be resolved
  2. GET /api/agent?directory=/tmp/proj (boots location services)
  3. POST /api/location/reload → 503 {"_tag":"ServiceUnavailableError","message":"TypeError: o is not a function. (In 'o()', ...)"}
  4. GET /api/skill?directory=/tmp/proj → {"data": []}

Caveat, to be precise: on a server where the same plugin set is already loaded, POST /api/location/reload
returns 204 and logs location services reloaded count=6. So it is not reload itself, it is the reload that
happens when the plugin set/instances change (or when a declared plugin fails to load) that takes the registry
down.

Expected

  • A plugin that fails to load should be skipped/reported, leaving the rest of the registry intact.
  • A failed reload should not leave every location without agents and skills.

Actual

  • The shared registry is dropped for all locations and every in-flight session dies mid-turn.

Impact

Any agent session on the machine dies when a declared plugin file is touched, including routine work by an
unrelated agent. Restarting the service is the only reliable recovery (an explicit POST /api/location/reload
sometimes restores it, sometimes returns 503).

Happy to test a specific build or provide full opencode.log excerpts.

Activity

  1. opencode-agent commented on Oct 26, 2026

    @opencode-agent
    opencode-agentBot
    on Oct 26, 2026 – with OpenCode Agent
    Contributor
    More actions

    Thanks for the detailed report and the two reproductions. I think this is a duplicate of #49982. That issue reports a failed plugin reload throwing TypeError: … is not a function. (In '…()', '…' is an instance of Object) on the background service. After it, custom agents and commands disappear in every location until the service is restarted. That's the same failure you're seeing, now confirmed on 2.1.4.

    Possible duplicates and closely related issues, ordered from most to least likely:

    • server: failed plugin reload on config change silently drops custom agents and commands until restart #49982: a failed plugin reload (pe is not a function … instance of Object) after plugin files changed or were deleted leaves only builtin agents and commands until restart.
    • plugin: session-hook plugin activation triggers failed reload and wipes provider registry #52618: saving a plugin file causes failed reloads (re is not a function) in every location, which wipe the provider registry and sometimes cause Session.AgentNotFoundError.
    • cli: opencode reload against the background service crashes with TypeError in ServerProcess.start / Worktree.refresh (2.1.2, Windows); --standalone reload works #57719: opencode reload against the background service crashes with the same kind of TypeError. Open PR fix(plugin): only call function return values when tearing down a plugin #57775 proposes a fix that only calls a plugin's cleanup if it's actually a function.
    • A throwing plugin cleanup during reload aborts the generation swap and silently drops builtin registrations #57089: a plugin cleanup that throws during reload aborts the swap and drops builtin registrations.
    • Agent not found for an existing agent while plugins reload after a plugin file changes #54172: "Agent not found" while plugins reload after a plugin file changes (closed).
    • core: concurrent location plugin reloads crash with r.base.get #48121: concurrent plugin reloads across locations crash and can leave agents or providers unavailable.

    Your reproductions (a declared plugin directory moved or modified while sessions are running) and the 2.1.4 confirmation would be useful additions on #49982.

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

  2. opencode-agent
    added
    pending close
    triaging
    on Oct 26, 2026
  3. rekram1-node commented on Oct 28, 2026

    @rekram1-node
    rekram1-node
    on Oct 28, 2026
    Member
    More actions

    Closing as a duplicate of the issue linked above. If this turns out to be a different problem, comment here and we'll reopen it.

  4. rekram1-node
    closed this as duplicateon Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    pending closetriaging

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.