JuliusBrussee/caveman · error

unknown command ; run caveman-agent --help

Error message

unknown command ${JSON.stringify(command)}; run caveman-agent --help

What it means

The caveman-agent CLI main() dispatches known commands (including dev, build, check, doctor, register). If the first positional argument does not match any known command, it throws this error listing the attempted command and pointing at --help.

Solutions

  1. Run `caveman-agent --help` to list valid commands.
  2. Correct the typo in the command name (e.g. doctor, not docter).
  3. Check the installed package version; if a documented command is missing, upgrade the package.

Example fix

// before
npx caveman-agent docter
// after
npx caveman-agent doctor
Defensive patterns

Strategy: validation

Validate before calling

const COMMANDS = ["dev", "build", "check", "doctor", "register"];
if (!COMMANDS.includes(process.argv[2] ?? "")) {
  console.error(`unknown command; run caveman-agent --help`);
  process.exit(1);
}

Try / catch

main(process.argv.slice(2)).catch((e) => {
  if (String(e.message).startsWith("unknown command")) {
    console.error(e.message);
    process.exit(2);
  }
  throw e;
});

Prevention

When it happens

Trigger: Running `caveman-agent <typo>` (e.g. "caveman-agent docter", "caveman-agent verion") or invoking a subcommand that does not exist in this CLI version.

Common situations: Typo in the command name; reading outdated docs for a command that was renamed or removed; shell alias resolving to an unexpected first argument.

Related errors


AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20). Data as JSON: /api/errors/4050e1db4ac658ce. Report an issue: GitHub.

Appendix: source

Thrown at packages/agent/src/cli.ts:92

    return;
  }
  if (command === "build") {
    await build(args);
    return;
  }
  if (command === "check") {
    await check(args);
    return;
  }
  if (command === "doctor") {
    await doctor(args);
    return;
  }
  if (command === "register") {
    await register(args);
    return;
  }
  throw new Error(`unknown command ${JSON.stringify(command)}; run caveman-agent --help`);
}

function printHelp(): void {
  process.stdout.write([
    "Caveman Agent — efficiency-native TypeScript agent framework",
    "",
    "Usage:",
    "caveman-agent dev [entry] [prompt]",
    "caveman-agent build [config]",
    "caveman-agent check [config]",
    "caveman-agent doctor [--json]",
    "caveman-agent register",
    "caveman-agent --version",
    "",
  ].join("\n"));
}

type DoctorStatus = "pass" | "warn" | "fail";

View on GitHub (pinned to 3ee70a1026)