Skip to content

subagent: spawn always fails with "free tier can only be used from within OpenCode" on stock install #55471

Closed as duplicate

Description

@UnixUserDev

Summary

Invoking the subagent tool fails every time with the error OpenCode's free tier can only be used from within OpenCode. Download it at https://opencode.ai and keep building., even though the session itself is running inside OpenCode (desktop app) on an OpenCode Zen model (opencode/mimo-v2.6-flash-free) and the main agent works fine. No local install files (app.asar or otherwise) are modified.

Environment

  • opencode version: v2.0.27 (opencode --version)
  • OS: Windows_NT 10.0.26340 (win32 x64)
  • Terminal: TERM=xterm-256color, TERM_PROGRAM and COLORTERM unset
  • Shell: custom shell at .opencode\tools\out\bash.exe (workspace wrapper that spawns PowerShell); ComSpec not set in the session process
  • Install/channel: release / latest (v2.0.27), stock desktop install, no patched app.asar or modified package files
  • Active plugins: none in config (.opencode/opencode.json has no plugin entries); local plugin folders exist under .opencode/plugins/: engram, instructions, messages, shell-shield, soundfx, toolbox

Reproduction

  1. Start OpenCode (desktop) on Windows v2.0.27 with .opencode/opencode.json containing "model": "opencode/mimo-v2.6-flash-free" and permissions including { "action": "subagent", "resource": "*", "effect": "allow" }.
  2. Start a normal chat session (main agent responds normally on the Zen model).
  3. Call the subagent tool, e.g. subagent({ agent: "planner", description: "Plan GLM Discord bot", prompt: "Decompose this into a plan..." }).
  4. The tool returns an error envelope instead of spawning a child session.
  5. Repeat — same failure.

Expected Behavior

The subagent tool should spawn a child session for the requested agent and return its response, since the parent session is authenticated and running inside OpenCode.

Actual Behavior

Every spawn fails immediately (2/2 attempts, different session IDs each time):

{"error":{"type":"tool.execution","message":"Subagent failed (sessionID: ses_ec4c0e3c1ffe2FBVrY4fs5OUEU): OpenCode's free tier can only be used from within OpenCode. Download it at https://opencode.ai and keep building."}}

Second attempt:

{"error":{"type":"tool.execution","message":"Subagent failed (sessionID: ses_ec4c09b1fffePNprxmfjwJ7Pcc): OpenCode's free tier can only be used from within OpenCode. Download it at https://opencode.ai and keep building."}}

Additional Context

  • The main agent in the same session works normally on the same provider/model (opencode/mimo-v2.6-flash-free) — only child-session spawn trips the "free tier" gate, so the child session appears to run without the parent's provider/auth context.
  • Reproducible: 100% (2/2 in this session), same message both times.
  • No config/plugin was changed before or during the failures; no install files modified.
  • Suspicion: the free-tier validity check in the subagent spawn path tests something the child session doesn't inherit (auth context / launcher detection) rather than the actual provider credentials.

Activity

  1. UnixUserDev commented on Oct 14, 2026

    @UnixUserDev
    Author

    OS clarification: this is Windows 11 Insider Preview (build 10.0.26340, Insider channel). The 10.0.26340 version string in the environment section is the Win11 Insider build number, not Windows 10 — flagging it in case the free-tier gate has any OS/build-dependent path (e.g. launcher detection under an unsigned preview build).

  2. opencode-agent commented on Oct 14, 2026

    @opencode-agent
    Contributor

    Thanks for the detailed report! I think this is a duplicate of #50806. That issue reports the same thing: spawning a custom subagent on a free OpenCode Zen model fails with "OpenCode's free tier can only be used from within OpenCode", while the parent session on the same model works.

    The cause is tracked in #50627. People there found that the free-tier check on the Console side rejects requests whose tool list leaves out some of the standard tools. This most often happens because the agent's permissions deny shell (so bash is dropped), but a small tool allowlist triggers it as well. That would explain why your main agent works and the planner subagent doesn't, even though it's the same model in the same session.

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

    Until it's fixed, people in #50627 report that changing the custom agent's shell rule from effect: deny to effect: ask, and not limiting it to a small tool allowlist, avoids the error. Using a built-in agent like general also works.

    The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different. For example, tell us if your planner agent has no permission or tool restrictions at all.

  3. UnixUserDev commented on Oct 14, 2026

    @UnixUserDev
    Author

    Confirmed duplicate of #50806 / root cause #50627 — happy for this to close as duplicate.

    Evidence from this workspace (custom planner agent):

    Environment detail from the follow-up applies here too: Windows 11 Insider build 10.0.26340, opencode v2.0.27, stock install (no modified app.asar).

  4. opencode-agent commented on Oct 14, 2026

    @opencode-agent
    Contributor

    Thanks for testing this so carefully, and for confirming.

    Your isolation test is useful: bash: deny alone triggers it, while edit: deny doesn't. One caveat is that #54744 reported a case where a small tool allowlist with bash still fails. So bash looks like the most common trigger rather than the only one. Please add your deny→ask and edit: deny results to #50627, where this is tracked and where they'll be seen next to the other reports.

    On the Windows 11 Insider note: the OS shouldn't matter here. The same error has been reproduced on Linux and macOS (see #50627 and #49723), and in your case it went away once you changed only the agent's permissions.

    Until it's fixed, bash: ask on the planner agent is the workaround. This issue will be closed as a duplicate of #50806 as planned. Please follow that issue and #50627 for updates.

  5. UnixUserDev commented on Oct 14, 2026

    @UnixUserDev
    Author

    FYI maintainers: the triage job that produced the verdict comment on this issue failed (the verdict itself was posted, then the run crashed):

    Log tail:

    16:34:23Z > triage · gpt-5.4-mini
    16:34:42Z (duplicate-verdict comment posted on this issue)
    16:34:43Z Error: {
                 "name": "UnknownError",
                 "data": {
                   "message": "Unexpected server error. Check server logs for details.",
                   "ref": "err_dd23143e"
                 }
               }
    16:34:43Z ##[error]Process completed with exit code 1.
    

    So the triage model emitted its reply and the comment landed, but opencode run then returned an UnknownError server failure ~1s later and the job went red. Worth checking server logs for ref err_dd23143e in case any post-comment triage actions (label transitions / duplicate-close scheduling beyond the visible pending close + triaging labels) were skipped.

    Separately, the verdict itself checks out: I've since verified the #50627 workaround locally (see comment above) — bash: deny on the custom agent was the sole trigger, bash: ask fixes the spawn on opencode/mimo-v2.6-flash-free.

  6. opencode-agent commented on Oct 15, 2026

    @opencode-agent
    Contributor

    Closing this as a duplicate of #50806, as planned. Your own tests confirmed it's the same problem: the bash: deny rule on your custom planner agent trips the free-tier check on opencode/mimo-v2.6-flash-free, and changing it to bash: ask makes the subagent spawn work.

    The cause is tracked in #50627, so please follow that issue and #50806 for updates. Your isolation results (bash: deny fails, edit: deny alone is fine) would help most there. Until it's fixed, bash: ask is the workaround. Thanks again for the careful testing!

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