Skip to content

Custom primary agents rejected by Console free tier (MissingSessionID); built-in agents work #50943

Description

@Haurdarana

Bug: custom primary agents are rejected by the Console free tier (MissingSessionID) — built-in agents work

Environment

  • opencode Desktop v1.18.31 (@opencode-aidesktop) on Windows
  • Provider: opencode (OpenCode Zen), model opencode/big-pickle (keyless free tier)
  • Custom primary agent hermes (mode: primary, defined both inline in opencode.jsonc and as agent/core/hermes.md; also set as default_agent)

Symptom

Any request sent by the custom primary agent fails immediately, every time:

AI_APICallError: Error from provider (Console): OpenCode's free tier can only be used from within OpenCode

(server error type MissingSessionID — the message string is not present anywhere in the desktop client bundle, so it is produced by the Zen backend)

Evidence

From ~/.local/share/opencode/log/opencode.log, same app run, same provider/model, same session:

agent=hermes mode=primary session.id=ses_f30f79d63ffeat6eneU25KKLnI  -> stream error: "OpenCode's free tier can only be used from within OpenCode"  (2026-09-23 16:10:29)
agent=hermes mode=primary session.id=ses_f30f237edffemZw1IhNHqGeg22  -> stream error: same                                          (2026-09-23 16:16:23)
agent=build   mode=primary session.id=ses_f30f79d63ffeat6eneU25KKLnI  -> OK (repeatedly, right after the failure above)
agent=compaction mode=primary session.id=ses_f30f79d63ffeat6eneU25KKLnI -> OK
agent=coder   mode=subagent session.id=ses_f30df6c1effeq553V0i4zuKtGd -> OK (custom subagent, same model, live probe)
agent=title   mode=primary -> OK

So: built-in primary agents pass, custom primary agents always fail, and custom subagents pass. x-opencode-session is populated for the failing requests too (the client adds it at LLM run for any providerID.startsWith("opencode")).

Expected behavior

Custom primary agents should be admitted on the free tier exactly like built-in primary agents, or fail with a clear, actionable error (e.g., "custom agents require a Zen API key"), rather than the generic free-tier admission refusal.

Workaround

Using a keyed model (e.g. openai/*, google/*, or an OPENCODE_API_KEY) for the custom primary agent avoids the gate.

Activity

  1. jpozasm14 commented on Oct 7, 2026

    @jpozasm14

    Reproducible on 2.0.24 with a clean A/B isolation: the only difference is whether the agent is built-in or defined in .opencode/agents/.

    Environment

    • opencode version: 2.0.24 (service + CLI); also failed on 2.0.6 before updating
    • OS: Windows_NT 10.0.26200.9550 (win32 x64)
    • Terminal: WarpTerminal (TERM=xterm-256color), client: OpenCode Desktop 1.18.16
    • Shell: C:\Windows\system32\cmd.exe
    • Install/channel: npm (@opencode/cli), channel latest
    • Active plugins: none configured (built-ins only)

    Reproduction

    1. Define a custom subagent in .opencode/agents/planner.md (mode: subagent, no model field — inherits the default free-tier model).
    2. From a working built-in primary session, spawn the built-in explore subagent with a trivial prompt → succeeds: EXPLORE OK.
    3. Immediately spawn the custom planner subagent with a trivial prompt → fails with the error below.
    4. Launch a custom mode: primary agent (.opencode/agents/coordinator.md) from the TUI → same error.
    5. Updated everything first: CLI/service 2.0.6 → 2.0.24 (fresh install) and restarted the service → same failure on the new version.

    Expected Behavior

    Custom agents should behave like built-in agents: same auth, same model, same session → same successful response.

    Actual Behavior

    AI.Error.Authentication: Error from provider (Console): OpenCode's free tier can only be used from within OpenCode

    Server log (repeated for every custom-agent attempt, after the 2.0.24 update):

    level=ERROR message="Failed to drain Session" cause="AI.Error: Error from provider (Console):
    OpenCode's free tier can only be used from within OpenCode ... [cause]: AI.Error.Authentication"
    

    Evidence

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions