{"record":{"id":"6d0151dd2fe1375c","repo":"slopus/happy","slug":"missing-command-after-usage-happy-acp-c","errorCode":null,"errorMessage":"Missing command after \"--\". Usage: happy acp -- <command> [args]","messagePattern":"Missing command after \"--\"\\. Usage: happy acp -- <command> \\[args\\]","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/happy-cli/src/agent/acp/acpAgentConfig.ts","lineNumber":25,"sourceCode":"  gemini: { command: 'gemini', args: ['--experimental-acp'] },\n  opencode: { command: 'opencode', args: ['acp'] },\n};\n\nexport type ResolvedAcpAgentConfig = {\n  agentName: string;\n  command: string;\n  args: string[];\n};\n\nexport function resolveAcpAgentConfig(cliArgs: string[]): ResolvedAcpAgentConfig {\n  if (cliArgs.length === 0) {\n    throw new Error('Usage: happy acp <agent-name> or happy acp -- <command> [args]');\n  }\n\n  if (cliArgs[0] === '--') {\n    const command = cliArgs[1];\n    if (!command) {\n      throw new Error('Missing command after \"--\". Usage: happy acp -- <command> [args]');\n    }\n    return {\n      agentName: command,\n      command,\n      args: cliArgs.slice(2),\n    };\n  }\n\n  const agentName = cliArgs[0];\n  const known = KNOWN_ACP_AGENTS[agentName];\n  if (known) {\n    const passthroughArgs = cliArgs\n      .slice(1)\n      // Backward-compatible with old OpenCode docs/flags.\n      .filter((arg) => !(agentName === 'opencode' && arg === '--acp'));\n    return {\n      agentName,\n      command: known.command,","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/slopus/happy/blob/b824cd0a4681d41af631a8e422a813873e4455b0/packages/happy-cli/src/agent/acp/acpAgentConfig.ts#L7-L43","documentation":"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.","triggerScenarios":"Running `happy acp --` with nothing after it; quoting mistakes that swallow the command; a trailing `--` left by a script that intended to append args.","commonSituations":"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.","solutions":["Add the command right after `--`: `happy acp -- npx @example/agent`.","If you meant a registered agent, drop the `--` and use `happy acp <agent-name>`.","Check script variable expansion that produced empty values before `--`."],"exampleFix":"// before\n$ happy acp --\n// after\n$ happy acp -- npx @zed_industries/claude-code-acp","handlingStrategy":"validation","validationCode":"if (cliArgs[0] === '--' && !cliArgs[1]) {\n  console.error('Provide a command after --, e.g. happy acp -- npx @example/agent');\n  process.exit(1);\n}","typeGuard":null,"tryCatchPattern":"try {\n  const cfg = resolveAcpAgentConfig(cliArgs);\n} catch (err) {\n  if (err instanceof Error && err.message.includes('Missing command after')) {\n    printAcpUsage();\n    process.exit(1);\n  } else throw err;\n}","preventionTips":["Never end an argv with a bare `--`; ensure the executable follows it.","Beware variable expansion producing empty strings before `--` in scripts.","Remember `--` separates happy's flags from the spawned command's own flags."],"tags":["cli","usage","arguments","validation"],"backgroundTag":"missing-required-argument","analyzedSha":"b824cd0a4681d41af631a8e422a813873e4455b0","analyzedAt":"2026-08-31T23:12:36.205Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}