{"record":{"id":"c5c6c8a9e9f81688","repo":"JuliusBrussee/caveman","slug":"unknown-usage-subcommand-s","errorCode":null,"errorMessage":"unknown usage subcommand: %s","messagePattern":"unknown usage subcommand: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"proxy/cmd/caveman-proxy/main.go","lineNumber":533,"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\tsources := strings.Split(argFlag(args, \"--sources\", \"codex,claude,caveman\"), \",\")\n\tsince := argFlag(args, \"--since\", \"30d\")\n\n\tswitch sub {\n\tcase \"scan\":","sourceCodeStart":515,"sourceCodeEnd":551,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/proxy/cmd/caveman-proxy/main.go#L515-L551","documentation":"The `usage` command dispatcher received a subcommand token outside its known set (import, link, refresh, unlink) and exited 1 via fatalJSON with the token echoed. Same strict-dispatch pattern as the other subcommand trees.","triggerScenarios":"Typos (`usage impor`), or plausible-but-absent verbs: `usage stats`, `usage show`, `usage list`. Only the four link/refresh lifecycle verbs exist under usage.","commonSituations":"Users looking for read/report operations under usage (they live elsewhere, e.g. stats); scripts written from memory rather than help; version differences in the subcommand set.","solutions":["Use one of: import, link, refresh, unlink","Run the binary with no args / --help to dump the command tree for your version","For usage reporting, use the stats command instead of usage"],"exampleFix":"# before\ncaveman-proxy usage stats\n\n# after\ncaveman-proxy stats            # reporting lives here\ncaveman-proxy usage refresh claude  # lifecycle verbs live under usage","handlingStrategy":"validation","validationCode":"case \"$SUB\" in import|link|refresh|unlink) caveman-proxy usage \"$SUB\" \"$@\";; *) echo \"unknown usage subcommand: $SUB\" >&2;; esac","typeGuard":null,"tryCatchPattern":null,"preventionTips":["The usage tree is lifecycle-only (import/link/refresh/unlink); reporting lives under stats","Dump the command tree from help when scripting against an upgraded binary","Spell-check verbs in automation; typos exit 1 with no partial effects"],"tags":["cli","usage-error","exit-1"],"backgroundTag":null,"analyzedSha":"27d5a3981a347890211bb1bf2439e5c821a63bc9","analyzedAt":"2026-08-15T09:26:11.751Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}