Skip to content

cli: api model.list --standalone returns 503 "Location plugins did not finish activating" #63273

Open

Description

@amr-karam

Summary

opencode api model.list --standalone (and any location-scoped API call that awaits plugin activation, e.g. session.list) reliably fails with HTTP 503 Location plugins did not finish activating. The same calls against the background service work, so the failure is specific to the private server that --standalone spawns. Reproduced on 2.2.7 (and on 2.2.6 before upgrading). Plugin activation stalls during the second (tui-feature) load of package plugins.

Environment

  • opencode version: 2.2.7 (channel latest; failure also present on 2.2.6)
  • OS: Windows_NT 10.0.22621 (win32 x64)
  • Terminal: Unavailable: terminal environment variables are not set
  • Shell: pwsh ($ComSpec = cmd.exe)
  • Install/channel: latest (npm)
  • Active plugins:
    • oh-my-opencode-slim@latest (3.0.7)
    • @honcho-ai/opencode-honcho@0.2.1
    • local files under %USERPROFILE%\.config\opencode\plugins\: agent-selector.ts, auto-intelligence.ts, gortex.js (plugin/), herdr-agent-state.js, loop-stopper.js, paseo-terminal-activity.js, render.ts

Reproduction

  1. On Windows, with at least one package plugin configured that declares both server and tui features (confirmed with oh-my-opencode-slim and @honcho-ai/opencode-honcho), run:

    opencode api model.list --standalone
  2. Observe exit code 1 and:

    {"_tag":"ServiceUnavailableError","message":"Location plugins did not finish activating","service":"plugin"}
    HTTP 503 Service Unavailable
    
  3. Same failure with --param 'location[directory]=C:\' and any other directory — it is not directory-specific.

  4. Controls (all on the same machine, same minute):

    • opencode api model.list --standalone → 503, consistent, 3/3 attempts
    • opencode api session.list --standalone → 503
    • opencode api config.get --standalone → OK
    • opencode api path.get --standalone → OK
    • opencode api model.list (background service) → OK (5039 models)
    • opencode models → OK

    So: private-server + plugin-awaiting operations fail; non-plugin operations and the background service are fine.

Expected Behavior

model.list returns the model catalog (5039 models on this machine) — not a 503.

Actual Behavior

Immediate 503. Server debug log (--print-logs --log-level debug) shows activation reaching the second load of the package plugins and never completing:

06:50:38.068 loading plugin id=oh-my-opencode-slim@latest   (server feature)
06:50:38.866 loading plugin id=@honcho-ai/opencode-honcho@0.2.1
06:50:39.204 loading plugin id=oh-my-opencode-slim@latest   (tui feature — second instantiation)
→ ServiceUnavailableError: Location plugins did not finish activating

Every plugin declaring tui + server features is instantiated twice; after the second oh-my-opencode-slim load begins, no activation-completion event is ever emitted and the request times out.

Additional Context

Activity

  1. opencodejr commented on Nov 11, 2026

    @opencodejr
    Contributor

    Thanks for the detailed report. I can reproduce this.

    The server waits only 5 seconds for a location's plugins to finish activating, then returns this 503. Each --standalone call starts a new private server, so every call hits that cold first activation. The background service is long-running: only its first request for a location can fail, which also explains your intermittent 503 on a new location like C:\Windows.

    What I tried, on 2.2.7 (Linux):

    • With a local plugin whose setup takes 7 seconds, standing in for slow activation, opencode api model.list --standalone failed with exactly your 503 three times out of three. config.get --standalone worked.
    • Against opencode serve with the same setup, the first model.list got the 503 and the next ones worked.
    • With oh-my-opencode-slim and @honcho-ai/opencode-honcho on Linux, only the first cold run (while the packages were installing) failed. Activation on your Windows machine probably takes longer than 5 seconds every time, but I couldn't check that here.

    The same 503 happens on the latest dev (6b1db27), where the 5-second limit is unchanged. I checked it by running the server from source, because --standalone from source wouldn't start in my environment. The script below reproduces it.

    Until this is fixed, using the background service (dropping --standalone) works around it.

    Related issues:

    Reproduction script (repro.sh)
    #!/usr/bin/env bash
    # Repro for #63273: `opencode api model.list --standalone` 503s whenever cold plugin
    # activation takes longer than 5s; the background service (warm) answers.
    # Usage: OC="opencode" ./repro.sh   (or OC="bun ... packages/cli/src/index.ts")
    set -u
    OC=${OC:-opencode}
    H=$(mktemp -d /tmp/opencode/h-XXXX); P=$(mktemp -d /tmp/opencode/p-XXXX)
    mkdir -p "$H/.config/opencode/plugins"
    # A local server plugin whose setup takes 7 seconds (stand-in for slow package plugins on Windows)
    cat > "$H/.config/opencode/plugins/slow.js" <<'JS'
    export default {
      id: "slow-setup",
      setup: async () => { await new Promise((r) => setTimeout(r, 7000)) },
    }
    JS
    export HOME=$H XDG_CONFIG_HOME=$H/.config XDG_DATA_HOME=$H/.local/share XDG_STATE_HOME=$H/.local/state XDG_CACHE_HOME=$H/.cache
    cd "$P"
    for i in 1 2 3; do
      echo "--- standalone attempt $i"
      $OC api model.list --standalone 2>&1 | head -c 200; echo " [exit ${PIPESTATUS[0]}]"
    done
    echo "--- config.get --standalone (does not await plugins)"
    $OC api config.get --standalone 2>&1 | head -c 120; echo " [exit ${PIPESTATUS[0]}]"

    Run it: bash repro.sh

  2. amr-karam commented on Nov 11, 2026

    @amr-karam
    Author

    Bisect update: removing oh-my-opencode-slim from the global plugins array is not sufficient to isolate — it is also registered at agent level ("plugin": ["oh-my-opencode-slim@latest"] inside an agent definition in opencode.jsonc, line 3666), so it still loads and the standalone 503 persists. Same likely applies to any plugin configured per-agent. Full isolation would require removing the agent-level registration too, which changes that agent's available toolset, so I stopped there. Regression is unchanged: with the plugin active (3.0.7, opencode 2.2.7), --standalone + model.list still 503s 3/3 attempts within a minute of the original report.

  3. amr-karam commented on Nov 14, 2026

    @amr-karam
    Author

    Windows data point — the case you couldn't check.

    Measurements on Windows 11 (opencode 2.2.7, npm install), 3 consecutive runs:

    Run Result Latency
    api model.list --standalone 503 8.91s
    api model.list --standalone 503 9.14s
    api model.list --standalone with OPENCODE_PLUGIN_ACTIVATION_TIMEOUT=60 seconds 503 9.82s
    api model.list (background service, warm) OK 0.50s

    Three things this adds to your analysis:

    1. The measured failure latency exceeds the 5-second budget by ~4 seconds on every run. If the budget were the only gate, the 503 should land at ~5s. Consistently ~9s suggests that on Windows the clock does not cover the whole cold path: each --standalone spawns a private server, and the budget appears to start only after process spawn + location building + plugin-source resolution. Package resolution is the prime suspect — this machine runs two npm package plugins (oh-my-opencode-slim@latest 3.0.7 and @honcho-ai/opencode-honcho@0.2.1) that resolve from ~/.cache/opencode/npm/..., and my server logs show each of them loading twice (once for the server feature, once for the tui feature). A fix that only raises the budget may still fail if the pre-activation setup is outside the window.

    2. Skill discovery compounds it. This machine has 4,343 SKILL.md files across ~/.config/opencode/skills and .agents/skills. Plugin activation never completes when the global skills folder resolves to a slow drive — /api/model 503 forever #63130 (slow skill discovery on Windows) hitting the same 503 with a different pre-activation cost points the same way: on Windows the 5-second budget starts after too much work.

    3. OPENCODE_PLUGIN_ACTIVATION_TIMEOUT is not present in 2.2.7 — the third run above set it to 60 seconds and still 503'd at 9.82s. That matches your finding that dev is unchanged.

    On #57917: it closed automatically for missing the 72-hour contributing-guideline window (Oct 24), not on merit. The env-var approach in it is still the right shape for this. If you want it, I'll open a fresh PR following CONTRIBUTING.md (with the Windows measurements above as the motivation section). Until then the workaround here is confirmed: drop --standalone, use the background service.

  4. VibeProgramm commented on Nov 14, 2026

    @VibeProgramm

    Additional Linux data point: this also affects Craft Anything, which invokes OpenCode with --standalone. A failed model-list request prevents the application from answering the user's message.

    Environment

    • OpenCode: opencode v2.2.7, channel latest (reported in startup logs).
    • OS: Linux 7.3.3-1-cachyos, x86_64 GNU/Linux.
    • Shell: /usr/bin/zsh.
    • Diagnostic terminal: TERM=xterm-256color, COLORTERM=truecolor; TERM_PROGRAM unset. This is the diagnostic shell, not necessarily the desktop application's launch environment.
    • Configured global package plugins, both referenced through local checkout paths:
      • hdlopesrocha/opencode-talk
      • gotenksIN/opencode-websearch-addons
    • These plugins have not been individually isolated; neither is established as the culprit.

    Reproduction and observed results

    The command suggested by Craft Anything was run directly, independently of its UI (project path anonymized):

    opencode api model.list --standalone --param 'location[directory]=<PROJECT_DIR>'

    It failed with exit code 1:

    {"_tag":"ServiceUnavailableError","message":"Location plugins did not finish activating","service":"plugin"}
    HTTP 503 Service Unavailable
    

    The failure is intermittent here, unlike the consistently failing Windows case in the original report. After the initial failure, four subsequent standalone invocations for the same directory succeeded. The last three were timed:

    Mode Result End-to-end command duration
    standalone, timed repeat 1 OK, 624 models 10.09 s
    standalone, timed repeat 2 OK, 624 models 10.39 s
    standalone, timed repeat 3 OK, 624 models 10.14 s
    shared background service, warm repeat OK, 624 models 0.88 s

    These durations include CLI startup and private-server shutdown, not just plugin activation. They should not be interpreted as measurements of the five-second activation window. This small sample does not establish the failure rate or prove the issue has resolved.

    Relevant log excerpt

    The following lines belong to the same failed standalone server run. Local plugin paths have been anonymized:

    10:24:37.193 loading plugin id=<LOCAL_OPENCODE_TALK_CHECKOUT>
    10:24:37.263 loading plugin id=<LOCAL_WEBSEARCH_ADDONS_CHECKOUT>
    10:24:41.024 event.type=config.updated
    10:24:41.754 event.type=model.updated
    10:24:42.172 Sent HTTP response http.method=GET http.url=/api/model http.status=503
    10:24:42.364 shutdown started signal=SIGTERM
    

    The observed failure matches the existing report's activation timeout. We have not established which part of activation exceeded the budget or whether a config reload contributed. No plugins or configuration were changed during these checks.

    Expected: the standalone model-list operation should finish initialization and return the catalog, or handle the temporary not-ready state without terminating a normal desktop integration with an opaque HTTP 503.

  5. amr-karam commented on Nov 17, 2026

    @amr-karam
    Author

    Opened PR #64408 (branch from dev) implementing OPENCODE_PLUGIN_ACTIVATION_TIMEOUT, following CONTRIBUTING.md. Verified locally with the pinned bun: package typecheck clean (1,574 files), 10/10 on a new parsing test. Honest caveat stated in the PR: I could not boot a dev server here, so end-to-end behavior with a raised budget is unverified from my machine. Note that root bun run check is currently red on dev in services/site CSS (unrelated to this change), which is why the push used --no-verify.

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