Skip to content

Opencode: Custom Slash Command Error #527

@ahostetler300

Description

@ahostetler300

Agent: OpenCode
Model: Gemini Flash 3

I've started creating my own slash commands, and I frequently get the following error in Maestro.

Agent exited with code 1opencode run [message..]run opencode with a messagePositionals: message message to send [array] [default: []]Options: -h, --help show help [boolean] -v, --version show version number [boolean] --print-logs print logs to stderr [boolean] --log-level log level [string] [choices: "DEBUG", "INFO", "WARN", "ERROR"] --command the command to run, use message for args [string] -c, --continue continue the last session [boolean] -s, --session session id to continue [string] --fork fork the session before continuing (requires --continue or --session) [boolean] --share share the session [boolean] -m, --model model to use in the format of provider/model [string] --agent agent to use [string] --format format: default (formatted) or json (raw JSON events) [string] [choices: "default", "json"] [default: "default"] -f, --file file(s) to attach to message [array] --title title for the session (uses truncated prompt if no value provided) [string] --attach attach to a running opencode server (e.g., http://localhost:4096) [string] --dir directory to run in, path on remote server if attaching [string] --port port for the local server (defaults to random port if no value provided)[number] --variant model variant (provider-specific reasoning effort, e.g., high, max, minimal) [string] --thinking show thinking blocks [boolean] [default: false]

If I start a new session, the /command typically works (ie. I have a /prime command that reads through the codebase and creates a project summary).

However, if there is existing session context and I run a slash command, then I almost always get this error.

The exception is the built-in /commit command, that one almost always works...maybe it's handled differently.

Here is the /prime prompt for reference, but note that I am experiencing this with other custom /commands as well. Running /prime twice has consistently produced this error.

`---
description: Prime agent with codebase understanding

Prime: Load Project Context

Objective

Build comprehensive understanding of the codebase by analyzing structure, documentation, and key files.

Act as the Primary Orchestrator. Your goal is to initialize this session by dispatching specialized sub-agents (Task Tool) to research different layers of the codebase.

Process

1. Documentation Research (Sub-Agent A )

Use task to dispatch a "Product Architect":

  • File Map:: Run git ls-files and tree -L 5 -I 'node_modules|__pycache__|.git|dist|build' in order to understand the file structure
  • Documentation: Read PRD.md, rules.md, and the root README to get an overview of the application.
  • Tech Stack:: Analyze package.json, tech_stack or equivalent to identify the tech stack.
  • Return Only: The "Functional Application Summary" including project goals, tech stack, application features, and uses cases.

2. Technical Research (Sub-Agent B )

  • File Map:: Run git ls-files and tree -L 5 -I 'node_modules|__pycache__|.git|dist|build' in order to understand the file structure
  • Documentation: Read PRD.md, rules.md, and the root README to get an overview of the application.
  • Application Features: Scan Main entry points (main.py, index.ts, app.py, etc.) and Core configuration files (pyproject.toml, package.json, tsconfig.json) to identify core routing and feature logic.
  • Data Layer:: Scan the database schema to understand the data layer.
  • Return Only: The "Technical Application Summary" including tech stack, application features, AI capabilities, data relationships, and styling.

3. State & Activity Research (Sub-Agent C)

Use task to dispatch a "Git Historian":

  • Analyze the last 10 commits git log -20 --oneline and current status git status.
  • Return Only: A summary of the "Work in Progress" current state and recent development focus.

4. Final Output Report

Once all sub-agents have reported back, synthesize their findings into a concise report:

Output Report

Provide a concise summary, adhearing strictly to this specific markdown structure:

Project Overview

  • Purpose and type of application
  • Primary technologies and frameworks
  • Current version/state

Use Cases

  • Summary of the use cases for the application
  • What are users able to do with this application

Key Features

  • Key capabilities of the application
  • Key functions of the application

Architecture

  • Overall structure and organization
  • Key architectural patterns identified
  • Important directories and their purposes

Tech Stack

  • Languages and versions
  • Frameworks and major libraries
  • Build tools and package managers
  • Testing frameworks

Core Principles

  • Code style and conventions observed
  • Documentation standards
  • Testing approach

Current State

  • Active branch
  • Recent changes or development focus
  • Any immediate observations or concerns

Make this summary easy to scan - use bullet points and clear headers.
`

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