Skip to content

[Bug / Docs]: CLI command "opencode agent create" returns "Unexpected positional argument: create" #57406

Closed

Description

@linares-it

Description

Describe the bug:
According to the official documentation on opencode.ai/docs/agents/ and opencode.ai/docs/cli/, running opencode agent create should launch an interactive prompt to create a new custom agent.However, when executing this command on OpenCode v2.1.0, the CLI throws an unexpected positional argument error.To ReproduceOpen terminal on Ubuntu.Run the command: Bashopencode agent create
Observe the error output.Expected behavior:
The CLI should execute the interactive creation prompt for custom agents as described in the official documentation.Actual behavior / OutputPlaintextERROR
Unexpected positional argument: "create"
Environment:
OpenCode Version: v2.1.0OS: Ubuntu 26.04.1 LTS

Plugins

none

OpenCode version

v2.1.0

Steps to reproduce

Open the WSL terminal and run opencode agent create

Screenshot

No response

Operating System

wsl Ubuntu 26.04.1 LTS

Terminal

Terminal Windows
Versión: 1.24.12741.0

Activity

  1. opencode-agent commented on Oct 20, 2026

    @opencode-agent
    Contributor

    Thanks for the report! I can confirm this on v2.1.0: opencode agent create (and opencode agent list) fail with Unexpected positional argument: "create" / "list", and the CLI help lists no agent subcommand. It still happens on the latest dev (133b1eb). The v2 CLI has no agent command, but the CLI and Agents docs still describe one. The script below reproduces it.

    Until this is sorted out, you can create an agent by hand as a markdown file in .opencode/agents/ (project) or your global config's agents directory, as described in the Agents docs. opencode debug agents lists the agents OpenCode has loaded.

    Reproduction script (repro.sh)
    #!/usr/bin/env bash
    # Reproduces #57406: `opencode agent create` (documented in docs/cli and docs/agents) is not a v2 command.
    # Usage: ./repro.sh            -> uses `opencode` on PATH (e.g. bun add -g @opencode/[email protected])
    #        OC_DEV=/path/to/repo ./repro.sh -> runs the CLI from a source checkout
    set -u
    dir=$(mktemp -d); cd "$dir"
    if [ -n "${OC_DEV:-}" ]; then
      oc() { bun --conditions=browser --preload="$OC_DEV/packages/tui/node_modules/@opentui/solid/scripts/preload.js" "$OC_DEV/packages/cli/src/index.ts" "$@"; }
    else
      oc() { opencode "$@"; }
    fi
    echo "version: $(oc --version)"
    for sub in create list; do
      echo "== opencode agent $sub"
      oc agent $sub 2>&1 | grep -A1 '^ERROR'
      echo "exit=${PIPESTATUS[0]}"
    done

    Run it: bash repro.sh

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