{"record":{"id":"0289bca6c58531cf","repo":"JuliusBrussee/caveman","slug":"usage-unlink-needs-claude-codex","errorCode":null,"errorMessage":"usage unlink needs claude|codex","messagePattern":"usage unlink needs claude\\|codex","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"proxy/cmd/caveman-proxy/main.go","lineNumber":652,"sourceCode":"\t\t\t}\n\t\t\tprintJSON(out)\n\t\tdefault:\n\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","sourceCodeStart":634,"sourceCodeEnd":670,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/proxy/cmd/caveman-proxy/main.go#L634-L670","documentation":"Thrown by runUsage's `unlink` branch: the provider positional must be claude/anthropic or codex/openai. The default case rejects everything else with this usage message, because DeleteQuotaProvider only supports the anthropic and openai quota provider keys.","triggerScenarios":"`caveman-proxy usage unlink` with no provider, `usage unlink gemini`, `usage unlink vertex`, or any misspelled provider.","commonSituations":"Running `unlink` bare expecting a default (unlike `link`/`refresh`, empty provider is not accepted here); trying to unlink a provider that was never linkable via this CLI.","solutions":["Specify the provider: `caveman-proxy usage unlink claude` (or `anthropic`) or `caveman-proxy usage unlink codex` (or `openai`).","Use the aliased spellings only where accepted; both claude/anthropic and codex/openai pairs map to the same underlying quota provider.","Check which quota providers are linked via the usage/stats output before unlinking."],"exampleFix":"// before\ncaveman-proxy usage unlink\n// after\ncaveman-proxy usage unlink claude","handlingStrategy":"validation","validationCode":"// shell\nif [ -z \"$PROVIDER\" ]; then echo \"usage unlink needs claude|codex\" >&2; exit 2; fi\ncase \"$PROVIDER\" in claude|anthropic|codex|openai) ;; *) echo \"unsupported unlink provider: $PROVIDER\" >&2; exit 2;; esac\ncaveman-proxy usage unlink \"$PROVIDER\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Unlike link/refresh, unlink has no empty-provider default — always pass one.","anthropic and openai are accepted aliases here but map to claude and codex respectively.","Confirm the provider is currently linked before unlinking."],"tags":["cli","missing-argument","usage-unlink"],"backgroundTag":"missing-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"}