slopus/happy · error · Error

Missing command after "--". Usage: happy acp -- <command> [a

Error message

Missing command after "--". Usage: happy acp -- <command> [args]

What it means

When the first CLI argument is `--`, resolveAcpAgentConfig expects an inline command immediately after it. If `--` is the last token, there is no command to spawn, so it throws this usage error.

Source

Thrown at packages/happy-cli/src/agent/acp/acpAgentConfig.ts:25

  gemini: { command: 'gemini', args: ['--experimental-acp'] },
  opencode: { command: 'opencode', args: ['acp'] },
};

export type ResolvedAcpAgentConfig = {
  agentName: string;
  command: string;
  args: string[];
};

export function resolveAcpAgentConfig(cliArgs: string[]): ResolvedAcpAgentConfig {
  if (cliArgs.length === 0) {
    throw new Error('Usage: happy acp <agent-name> or happy acp -- <command> [args]');
  }

  if (cliArgs[0] === '--') {
    const command = cliArgs[1];
    if (!command) {
      throw new Error('Missing command after "--". Usage: happy acp -- <command> [args]');
    }
    return {
      agentName: command,
      command,
      args: cliArgs.slice(2),
    };
  }

  const agentName = cliArgs[0];
  const known = KNOWN_ACP_AGENTS[agentName];
  if (known) {
    const passthroughArgs = cliArgs
      .slice(1)
      // Backward-compatible with old OpenCode docs/flags.
      .filter((arg) => !(agentName === 'opencode' && arg === '--acp'));
    return {
      agentName,
      command: known.command,

View on GitHub (pinned to b824cd0a46)

Solutions

  1. Add the command right after `--`: `happy acp -- npx @example/agent`.
  2. If you meant a registered agent, drop the `--` and use `happy acp <agent-name>`.
  3. Check script variable expansion that produced empty values before `--`.

Example fix

// before
$ happy acp --
// after
$ happy acp -- npx @zed_industries/claude-code-acp
Defensive patterns

Strategy: validation

Validate before calling

if (cliArgs[0] === '--' && !cliArgs[1]) {
  console.error('Provide a command after --, e.g. happy acp -- npx @example/agent');
  process.exit(1);
}

Try / catch

try {
  const cfg = resolveAcpAgentConfig(cliArgs);
} catch (err) {
  if (err instanceof Error && err.message.includes('Missing command after')) {
    printAcpUsage();
    process.exit(1);
  } else throw err;
}

Prevention

When it happens

Trigger: Running `happy acp --` with nothing after it; quoting mistakes that swallow the command; a trailing `--` left by a script that intended to append args.

Common situations: Copy-pasting a command template and omitting the executable; scripts that build the argv dynamically and produce an empty command slot; confusion between `--` for happy vs the agent's own flags.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of slopus/happy@b824cd0a46 (2026-08-31). Data as JSON: /api/errors/6d0151dd2fe1375c. Report an issue: GitHub.