{"record":{"id":"d2673be9f2a81d0c","repo":"JuliusBrussee/caveman","slug":"usage-caveman-proxy-usage-import-codex-claude","errorCode":null,"errorMessage":"usage: caveman-proxy usage import codex|claude","messagePattern":"usage: caveman-proxy usage import codex\\|claude","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"proxy/cmd/caveman-proxy/main.go","lineNumber":602,"sourceCode":"\tdefault:\n\t\tfatalJSON(logger, fmt.Errorf(\"unknown trial subcommand: %s\", sub))\n\t}\n}\n\nfunc runUsage(logger *slog.Logger, args []string) {\n\tif len(args) == 0 {\n\t\tfatalJSON(logger, fmt.Errorf(\"usage: caveman-proxy usage import|link|refresh|unlink <provider>\"))\n\t}\n\tsub := args[0]\n\targs = args[1:]\n\thome := mustHome(logger)\n\tspend := mustStore(logger, home)\n\tdefer spend.Close()\n\tprovider := firstPositional(args)\n\tswitch sub {\n\tcase \"import\":\n\t\tif provider == \"\" {\n\t\t\tfatalJSON(logger, fmt.Errorf(\"usage: caveman-proxy usage import codex|claude\"))\n\t\t}\n\t\tpath := argFlag(args, \"--path\", \"\")\n\t\tsince := argFlag(args, \"--since\", \"\")\n\t\tswitch provider {\n\t\tcase \"codex\":\n\t\t\tout, err := spend.ImportCodex(path, since)\n\t\t\tif err != nil {\n\t\t\t\tfatalJSON(logger, err)\n\t\t\t}\n\t\t\tprintJSON(out)\n\t\tcase \"claude\":\n\t\t\tout, err := spend.ImportClaude(path, since)\n\t\t\tif err != nil {\n\t\t\t\tfatalJSON(logger, err)\n\t\t\t}\n\t\t\tprintJSON(out)\n\t\tdefault:\n\t\t\tfatalJSON(logger, fmt.Errorf(\"unknown usage source: %s\", provider))","sourceCodeStart":584,"sourceCodeEnd":620,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/proxy/cmd/caveman-proxy/main.go#L584-L620","documentation":"This is a CLI usage error from `caveman-proxy usage import`: the subcommand `import` requires exactly one positional provider argument, `codex` or `claude`. runUsage reads the provider with firstPositional(args) and calls fatalJSON when it is empty, because without it the command cannot know which local session store to import. It exits with a JSON-encoded error instead of a usage dump.","triggerScenarios":"Running `caveman-proxy usage import` with no provider positional at all (args[0] after the subcommand is empty). Note: any other non-empty value reaches the 'unknown usage source' error at main.go:620 instead.","commonSituations":"Typing `caveman-proxy usage import` while omitting the provider; scripting a bare `usage import` hoping defaults apply (there are none); forgetting that --path/--since are optional flags while the provider is mandatory.","solutions":["Add the provider positional: `caveman-proxy usage import codex` or `caveman-proxy usage import claude`.","Pass --path and --since flags if you want to target a specific session file or time window, e.g. `caveman-proxy usage import claude --path ~/.claude/projects --since 30d`.","Run `caveman-proxy usage` with no args to see the top-level subcommand list (import|link|refresh|unlink)."],"exampleFix":"// before\ncaveman-proxy usage import\n// after\ncaveman-proxy usage import claude --since 30d","handlingStrategy":"validation","validationCode":"// shell\nif [ -z \"$PROVIDER\" ]; then echo \"usage: caveman-proxy usage import codex|claude\" >&2; exit 2; fi\ncase \"$PROVIDER\" in codex|claude) ;; *) echo \"provider must be codex or claude\" >&2; exit 2;; esac\ncaveman-proxy usage import \"$PROVIDER\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass the provider positional explicitly; there is no default.","Remember import requires claude|codex exactly (no anthropic/openai aliases).","Wrap the CLI in a shell function that validates args before exec."],"tags":["cli","missing-argument","usage-import"],"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"}