{"record":{"id":"c5c6c8a9e9f81688","repo":"JuliusBrussee/caveman","slug":"unknown-usage-subcommand-s","errorCode":null,"errorMessage":"unknown usage subcommand: %s","messagePattern":"unknown usage subcommand: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"proxy/cmd/caveman-proxy/main.go","lineNumber":655,"sourceCode":"\t\t\tfatalJSON(logger, fmt.Errorf(\"unknown usage link source: %s\", provider))\n\t\t}\n\tcase \"unlink\":\n\t\tswitch provider {\n\t\tcase \"claude\", \"anthropic\":\n\t\t\tif err := spend.DeleteQuotaProvider(\"anthropic\"); err != nil {\n\t\t\t\tfatalJSON(logger, err)\n\t\t\t}\n\t\t\tprintJSON(map[string]any{\"unlinked\": \"claude\"})\n\t\tcase \"codex\", \"openai\":\n\t\t\tif err := spend.DeleteQuotaProvider(\"openai\"); err != nil {\n\t\t\t\tfatalJSON(logger, err)\n\t\t\t}\n\t\t\tprintJSON(map[string]any{\"unlinked\": \"codex\"})\n\t\tdefault:\n\t\t\tfatalJSON(logger, fmt.Errorf(\"usage unlink needs claude|codex\"))\n\t\t}\n\tdefault:\n\t\tfatalJSON(logger, fmt.Errorf(\"unknown usage subcommand: %s\", sub))\n\t}\n}\n\nfunc runLearn(logger *slog.Logger, args []string) {\n\tsub := \"scan\"\n\tif len(args) > 0 {\n\t\tsub = args[0]\n\t\targs = args[1:]\n\t}\n\thome := mustHome(logger)\n\tspend := mustStore(logger, home)\n\tdefer spend.Close()\n\tcwd, _ := os.Getwd()\n\t// Empty default defers to the store's normalizeSources default set, so new\n\t// session sources (gemini/opencode/aider) are scanned without this flag\n\t// needing to chase the adapter list.\n\tsources := strings.Split(argFlag(args, \"--sources\", \"\"), \",\")\n\tsince := argFlag(args, \"--since\", \"30d\")","sourceCodeStart":637,"sourceCodeEnd":673,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/proxy/cmd/caveman-proxy/main.go#L637-L673","documentation":"Thrown by runUsage's default branch when the first positional argument is not one of import|link|refresh|unlink. The usage command has exactly those four subcommands; anything else — including empty args, which are caught earlier with a usage line — produces this error.","triggerScenarios":"`caveman-proxy usage show`, `usage importx` (typo), `usage status`, or passing flags where a subcommand is expected.","commonSituations":"Guessing subcommand names from other CLI tools (e.g. `usage report`, `usage stats` — those belong to other top-level commands); typos; old scripts written before a subcommand was renamed.","solutions":["Use one of: `caveman-proxy usage import|link|refresh|unlink <provider>`.","For spend/report views use the `stats` command instead of `usage`.","Run `caveman-proxy --help` (or bare `caveman-proxy usage`) to see the accepted subcommands."],"exampleFix":"// before\ncaveman-proxy usage status\n// after\ncaveman-proxy stats","handlingStrategy":"validation","validationCode":"// shell\ncase \"$SUB\" in import|link|refresh|unlink) ;; *) echo \"usage subcommands: import|link|refresh|unlink\" >&2; exit 2;; esac\ncaveman-proxy usage \"$SUB\" \"$@\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Memorize the four subcommands: import, link, refresh, unlink.","Spend/report views live under the stats command, not usage.","Use tab completion or --help rather than guessing names."],"tags":["cli","invalid-subcommand","usage"],"backgroundTag":"invalid-cli-argument","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"}