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
{{ message }}
Repository navigation
api: /api/command returns an empty list for a location the server has not seen #63145
GET /api/command returns an empty list the first time a location is queried, and only includes the commands from ~/.config/opencode/commands/ about three seconds later. A client that reads the catalog once when a session starts gets an empty slash-command menu and never refreshes it.
Plugins
Two local plugins in ~/.config/opencode/plugins/ (Orca status hooks). The behaviour reproduces with them disabled.
OpenCode version
2.2.5, latest channel, pnpm global install (Windows).
Steps to reproduce
Put some commands in ~/.config/opencode/commands/ (16 Markdown files in my case).
Create any directory the server has not opened yet, e.g. %TEMP%\fresh.
Query it repeatedly, about one second apart:
opencode api get "/api/command?location[directory]=<that dir>" --server http://127.0.0.1:4015
Expected: the call waits for that location's catalog, or at least always returns the commands that do not depend on the location (built-ins and the global commands directory).
Actual: empty first, built-ins only on the next call, complete only after a few seconds.
Impact
Orca opens one chat per worktree and reads the catalog when the session starts. On a new worktree that read is [], so the / menu shows none of the generated /speckit.* commands for the rest of that chat. Sessions in an already-opened location are fine, which is why it only fails on new worktrees.
Additional context
On a long-running server I also saw deleting a file from ~/.config/opencode/commands/ drop all file-based commands from the catalog (back to just the 3 built-ins) for every location, until the next write in that directory restored all 16. Writing to that directory seems to be what triggers the catalog to be built.
Workaround: read /api/command for a location once or twice right after it is created, before any client reads it.
Operating System
Windows 11, 10.0.26300, x64.
Terminal
Orca-managed terminal, TERM=xterm-256color, commands issued from PowerShell 5.1 over cmd.exe.
Thanks for the detailed report. I was able to reproduce this.
I put 16 command files in ~/.config/opencode/commands/, started opencode serve and queried /api/command for a newly created directory once a second:
2.2.5: the first call returned only the 3 built-ins (init,review,goal). From the next call, about a second later, all 19 were there.
Latest dev (17c95db): the first call returned {"data":[]}, and the full list appeared a second later.
It was a little faster here on Linux than the ~3s you saw, but the behaviour is the same: the first read for a new location comes back before that location's commands are loaded. The script below reproduces it.
I did not test the second part (deleting a command file dropping all file commands). It looks closely related to #54545. Other related issues: #54192 (the same new-location race for MCP endpoints) and #49982.
I'd like to work on this. Before writing code: would you prefer the endpoint to wait for the location's commands to finish loading before answering, or the client to refresh its command list once loading completes? #54192 looks like the same race for MCP, so I'd rather follow whatever approach you want there.
I'd like to work on this. Before writing code: would you prefer the endpoint to wait for the location's commands to finish loading before answering, or the client to refresh its command list once loading completes? #54192 looks like the same race for MCP, so I'd rather follow whatever approach you want there.
I guess the best UX is option 1, so once you have the window ready, all commands are available. I prefer to wait 2/3 seconds.
@Halconmza Waiting would be nicer for a one-shot read, but the repo's AGENTS.md rules it out on purpose: server handlers never wait for plugin or catalog loading, and long-lived clients refresh on the matching *.updated event. The server already publishes command.updated once a location's commands load (packages/core/src/command.ts), and the app and ACP clients reload on it.
So for Orca the fix is to subscribe to command.updated for that location and refetch /api/command. The other part of your report (deleting one command file dropping all file commands) does look like a server bug, likely the same as #54545.
Maintainers, if you'd still rather have the endpoint wait here, tell me and I'll do that instead.
Activity
opencodejr commentedon Nov 10, 2026
Thanks for the detailed report. I was able to reproduce this.
I put 16 command files in
~/.config/opencode/commands/, startedopencode serveand queried/api/commandfor a newly created directory once a second:init,review,goal). From the next call, about a second later, all 19 were there.dev(17c95db): the first call returned{"data":[]}, and the full list appeared a second later.It was a little faster here on Linux than the ~3s you saw, but the behaviour is the same: the first read for a new location comes back before that location's commands are loaded. The script below reproduces it.
I did not test the second part (deleting a command file dropping all file commands). It looks closely related to #54545. Other related issues: #54192 (the same new-location race for MCP endpoints) and #49982.
Reproduction script (repro.sh)
Run it:
bash repro.shAnthony14FR commentedon Nov 11, 2026
I'd like to work on this. Before writing code: would you prefer the endpoint to wait for the location's commands to finish loading before answering, or the client to refresh its command list once loading completes? #54192 looks like the same race for MCP, so I'd rather follow whatever approach you want there.
Halconmza commentedon Nov 12, 2026
I guess the best UX is option 1, so once you have the window ready, all commands are available. I prefer to wait 2/3 seconds.
Anthony14FR commentedon Nov 12, 2026
@Halconmza Waiting would be nicer for a one-shot read, but the repo's AGENTS.md rules it out on purpose: server handlers never wait for plugin or catalog loading, and long-lived clients refresh on the matching
*.updatedevent. The server already publishescommand.updatedonce a location's commands load (packages/core/src/command.ts), and the app and ACP clients reload on it.So for Orca the fix is to subscribe to
command.updatedfor that location and refetch/api/command. The other part of your report (deleting one command file dropping all file commands) does look like a server bug, likely the same as #54545.Maintainers, if you'd still rather have the endpoint wait here, tell me and I'll do that instead.