Skip to content

[BUG] plan_exit throws error when build agent is disabled #9822

Closed

Description

@IgorWarzocha

Description

When the build agent is disabled via config (agent.build.disable: true - very niche I know, but could happen), the plan_exit tool throws an error when trying to exit plan mode. The tool appears to hardcode "build" as the target agent without checking if it exists or finding an available fallback.

Expected Behavior

Should fall back to an available primary agent (like plan or another custom agent) instead of erroring out.

Actual Behavior

Throws an error when trying to switch to the disabled build agent.

The issue appears to be in /packages/opencode/src/tool/plan.ts where the target agent is hardcoded to "build" without checking if that agent is available.

Plugins

not applicable

OpenCode version

latest, tested on dev

Steps to reproduce

  1. Configure build agent as disabled:
{
  "agent": {
    "build": { "disable": true }
  }
}
  1. Enter plan mode
  2. Try to exit plan mode using plan_exit
  3. Error is thrown

Screenshot and/or share link

Image

Operating System

Omarchy

Terminal

Ghostty

Activity

  1. changed the title [-]plan_exit throws error when build agent is disabled[/-] [+][BUG] plan_exit throws error when build agent is disabled[/+] on Jan 21, 2026
  2. wienans commented on Jan 21, 2026

    @wienans
    Contributor

    Fallback should be configurable. And if it is not configured, prompt the user a selection of the primary agents with the option to save for future tasks? Because if we pic the first primary agent which is not the plan agent that might be any agent which is actually not designed to do the implementation.

  3. added a commit that references this issue on Jan 22, 2026
    50760a5
  4. github-actions commented on Mar 28, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions