{"record":{"id":"4050e1db4ac658ce","repo":"JuliusBrussee/caveman","slug":"unknown-command-json-stringify-command-run-ca","errorCode":null,"errorMessage":"unknown command ${JSON.stringify(command)}; run caveman-agent --help","messagePattern":"unknown command (.+?); run caveman-agent --help","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/agent/src/cli.ts","lineNumber":92,"sourceCode":"    return;\n  }\n  if (command === \"build\") {\n    await build(args);\n    return;\n  }\n  if (command === \"check\") {\n    await check(args);\n    return;\n  }\n  if (command === \"doctor\") {\n    await doctor(args);\n    return;\n  }\n  if (command === \"register\") {\n    await register(args);\n    return;\n  }\n  throw new Error(`unknown command ${JSON.stringify(command)}; run caveman-agent --help`);\n}\n\nfunction printHelp(): void {\n  process.stdout.write([\n    \"Caveman Agent — efficiency-native TypeScript agent framework\",\n    \"\",\n    \"Usage:\",\n    \"caveman-agent dev [entry] [prompt]\",\n    \"caveman-agent build [config]\",\n    \"caveman-agent check [config]\",\n    \"caveman-agent doctor [--json]\",\n    \"caveman-agent register\",\n    \"caveman-agent --version\",\n    \"\",\n  ].join(\"\\n\"));\n}\n\ntype DoctorStatus = \"pass\" | \"warn\" | \"fail\";","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/packages/agent/src/cli.ts#L74-L110","documentation":"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.","triggerScenarios":"Running `caveman-agent <typo>` (e.g. \"caveman-agent docter\", \"caveman-agent verion\") or invoking a subcommand that does not exist in this CLI version.","commonSituations":"Typo in the command name; reading outdated docs for a command that was renamed or removed; shell alias resolving to an unexpected first argument.","solutions":["Run `caveman-agent --help` to list valid commands.","Correct the typo in the command name (e.g. doctor, not docter).","Check the installed package version; if a documented command is missing, upgrade the package."],"exampleFix":"// before\nnpx caveman-agent docter\n// after\nnpx caveman-agent doctor","handlingStrategy":"validation","validationCode":"const COMMANDS = [\"dev\", \"build\", \"check\", \"doctor\", \"register\"];\nif (!COMMANDS.includes(process.argv[2] ?? \"\")) {\n  console.error(`unknown command; run caveman-agent --help`);\n  process.exit(1);\n}","typeGuard":null,"tryCatchPattern":"main(process.argv.slice(2)).catch((e) => {\n  if (String(e.message).startsWith(\"unknown command\")) {\n    console.error(e.message);\n    process.exit(2);\n  }\n  throw e;\n});","preventionTips":["Run `caveman-agent --help` when unsure of a command name","Shell-complete command names instead of typing from memory","Pin and consult docs matching your installed package version"],"tags":["cli","command-not-found","typo"],"backgroundTag":"command-not-found","analyzedSha":"3ee70a102609e550bd2e68004bf5990a9341c851","analyzedAt":"2026-09-20T15:53:39.229Z","contentChangedAt":"2026-09-20T15:53:39.229Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}