Repository navigation
Description
Summary
This is the same defect as #62002 — a session cannot select its configured primary agent and dies with AgentNotFoundError — but it is not Orca-specific: it reproduces with plain opencode running in a normal terminal, MATE Terminal (VTE 0.76.0), no Orca window in that session's chain.
#62002 was closed as not planned on 2026-11-12 06:36 UTC, after the closing note said the configured default_agent "came back as soon as agents/ORACLE.md was restored" and that the behaviour only remained inside Orca's terminal. That explanation does not fit this setup, and the failure is still happening on 2.2.7 outside Orca. Reopening the original was not possible from this account (GraphQL: Could not reopen the issue. (reopenIssue) / REST 422), so this report carries the reproduction instead.
Environment
- opencode 2.2.7 (
opencode --version), Linux Mint, x86_64. - Terminal: MATE Terminal,
VTE_VERSION=7600,TERM=xterm-256color,COLORTERM=truecolor,TERM_PROGRAMunset. default_agent: "ORACLE"in~/.config/opencode/opencode.json, with the agent defined inline in theagentsblock of that same file. There is no~/.config/opencode/agent/ORACLE.md— so "restore the agent file" is not available as a workaround here.
What happens
The TUI keeps showing the configured agent in the status bar (ORACLE · DeepSeek V4.1 Flash 1017), while the server refuses to select it and drains the turn:
Error: Agent not found: "ORACLE"
Server log, same machine, 2026-11-12 — 9 occurrences today, each within seconds of a failed reload:
level=ERROR message="failed to reload plugins" cause="Cause([Die(TypeError: o is not a function. (In 'o()', 'o' is an instance of Object))])"
level=ERROR message="Failed to drain Session"
cause="Session.AgentNotFoundError: Agent not found: \"ORACLE\""
at SessionContext.select
at SessionRunner.prepareContext
at SessionRunner.advanceToStep
at SessionRunner.drain
at ServerProcess.start
Reload → failure pairs (local time):
| reload event | AgentNotFoundError |
|---|---|
| 10:21:43 failed to reload plugins | 10:21:43 · 10:23:57 |
| 10:59:34 failed to reload plugins | 10:59:36 · 10:59:59 · 11:00:35 |
| 11:04:21 failed to reload plugins | 11:04:22 |
| 11:40:27 plugin reconciliation | 11:40:27 · 11:41:17 |
| 11:47:57 failed to reload plugins | 11:48:16 |
A second primary agent defined the same way (ORCHESTRATOR) fails identically at 10:59:59, so it is not specific to one agent name. The same sessions survive until a reload runs; after it, the agent is gone from the registry. The config file was back to a valid, unchanged copy afterwards, and the affected sessions still did not recover the agent — only a restart did.
Expected
- A config file that is momentarily unreadable or invalid — an editor saving it, or a backup restored over
~/.config/opencode/— must not change the agent a running session uses. The session keeps the selection it already had. - When the file becomes valid again, the session must recover the configured
default_agentby itself. Today the loss is permanent: the file went back to normal and the open windows stayed without their agent until the session was restarted. - Restoring a backup over the config folder is the concrete trigger: it replaces
opencode.jsonwholesale, every open window loses its configured agent, and a perfectly valid restored file does not bring it back. - Agents defined inline in
opencode.json(not files underagent/) should survive that path — they are never re-read on their own, which is the reproducible core of this report.
Evidence
- Close-up of the error at the top of this report:
Error: Agent not found: "ORACLE", marked with 1, with the status bar readingORACLE · DeepSeek V4.1 Flash 1017directly below it. - Full MATE Terminal window with the OpenCode session: attached in the comments.
Related: #62002 (same failure, closed as not planned with an Orca-only explanation).
Activity
opencodejr commentedon Nov 12, 2026
Thanks for the detailed log and the reload-to-failure timeline. I think this is a duplicate of #49982. There, a plugin reload fails with
TypeError: … is not a function. (In '…()', '…' is an instance of Object). After that, the running service loses its custom agents until it is restarted, and sessions fail withAgent not found. Your log shows the same pair:failed to reload plugins … o is not a function, thenSession.AgentNotFoundError. It also isn't tied to Orca or to agents loaded from files.Possible duplicates and closely related issues, ordered from most to least likely:
pe is not a function … instance of Object) drops custom agents and commands from the running service until restart (open, reproduced).o is not a functionreload failure followed byAgentNotFoundErrorfor every location; closed as a duplicate of server: failed plugin reload on config change silently drops custom agents and commands until restart #49982.Agent not foundfor an existing agent while plugins reload, a brief window before the agent comes back (closed).re is not a function) wiping the provider registry.Until it is fixed, #49982 reports that
opencode service restartbrings the agents back.I'm closing this issue now as a duplicate of #49982. Please add your details there: the 2.2.7 version, the agents defined inline in
opencode.json, the log lines and timeline, and the screenshots. That is where this is being tracked. If you think this is a different problem, reply here and the issue will be reopened.gandb commentedon Nov 12, 2026
Duplicate confirmed by the triage bot — this is #49982 (open, labelled
reproduced, same failure). Full evidence, including the inline-agents case and the config-restored-but-not-recovered step, added there: #49982 (comment)opencodejr commentedon Nov 12, 2026
Thanks for confirming, and for adding the full evidence to #49982. Having the inline-agents case and the not-recovered step in one place helps. This issue will stay closed as a duplicate of #49982, and that is where updates will appear.
opencodejr commentedon Nov 12, 2026
Closing this as a duplicate of #49982, as you confirmed. Your 2.2.7 evidence is now on that issue: the inline agents in
opencode.json, the failed plugin reload followed byAgent not found, and the step where restoring the config did not bring the agent back. #49982 is where the fix is tracked and where updates will appear. If something turns out to be different from #49982, please open a new issue and link this one. Thanks for the thorough investigation.