JuliusBrussee/caveman · error
usage unlink needs claude|codex
Error message
usage unlink needs claude|codex
What it means
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.
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.
Example fix
// before caveman-proxy usage unlink // after caveman-proxy usage unlink claude
Defensive patterns
Strategy: validation
Validate before calling
// shell if [ -z "$PROVIDER" ]; then echo "usage unlink needs claude|codex" >&2; exit 2; fi case "$PROVIDER" in claude|anthropic|codex|openai) ;; *) echo "unsupported unlink provider: $PROVIDER" >&2; exit 2;; esac caveman-proxy usage unlink "$PROVIDER"
Prevention
- 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.
When it happens
Trigger: `caveman-proxy usage unlink` with no provider, `usage unlink gemini`, `usage unlink vertex`, or any misspelled provider.
Common situations: 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.
Understand the failure class
Background: "no subcommand specified" and "... is required": CLI errors when a required argument is missing — this error's family across 13 libraries.
Related errors
- no trial_id supplied and no trial runs exist
- usage: caveman-proxy learn applied
- usage: caveman-proxy learn apply
- usage: caveman-proxy learn simulate
- usage: caveman-proxy usage import codex|claude
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/0289bca6c58531cf.
Report an issue: GitHub.
Appendix: source
Thrown at proxy/cmd/caveman-proxy/main.go:652
}
printJSON(out)
default:
fatalJSON(logger, fmt.Errorf("unknown usage link source: %s", provider))
}
case "unlink":
switch provider {
case "claude", "anthropic":
if err := spend.DeleteQuotaProvider("anthropic"); err != nil {
fatalJSON(logger, err)
}
printJSON(map[string]any{"unlinked": "claude"})
case "codex", "openai":
if err := spend.DeleteQuotaProvider("openai"); err != nil {
fatalJSON(logger, err)
}
printJSON(map[string]any{"unlinked": "codex"})
default:
fatalJSON(logger, fmt.Errorf("usage unlink needs claude|codex"))
}
default:
fatalJSON(logger, fmt.Errorf("unknown usage subcommand: %s", sub))
}
}
func runLearn(logger *slog.Logger, args []string) {
sub := "scan"
if len(args) > 0 {
sub = args[0]
args = args[1:]
}
home := mustHome(logger)
spend := mustStore(logger, home)
defer spend.Close()
cwd, _ := os.Getwd()
// Empty default defers to the store's normalizeSources default set, so new
// session sources (gemini/opencode/aider) are scanned without this flagView on GitHub (pinned to 3ee70a1026)