{"record":{"id":"43138f1f786f7e69","repo":"JuliusBrussee/caveman","slug":"unknown-trial-subcommand-s","errorCode":null,"errorMessage":"unknown trial subcommand: %s","messagePattern":"unknown trial subcommand: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"proxy/cmd/caveman-proxy/main.go","lineNumber":585,"sourceCode":"\t\toutDir := argFlag(args, \"--out\", filepath.Join(home, \"exports\", \"trial-\"+trialID))\n\t\tpaths, err := spend.ExportTrial(plan, outDir)\n\t\tif err != nil {\n\t\t\tfatalJSON(logger, err)\n\t\t}\n\t\tprintJSON(map[string]any{\"trial_id\": trialID, \"export\": paths})\n\tcase \"promote\":\n\t\ttrialID := requiredTrialID(logger, spend, args)\n\t\toptimizerID := firstPositional(args)\n\t\tif optimizerID == \"\" {\n\t\t\tfatalJSON(logger, fmt.Errorf(\"usage: caveman-proxy trial promote <optimizer_id> --trial-id <id>\"))\n\t\t}\n\t\tplan, err := spend.BuildTrialPlan(trialID)\n\t\tif err != nil {\n\t\t\tfatalJSON(logger, err)\n\t\t}\n\t\tpromoteMove(logger, home, trialID, optimizerID, plan)\n\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}","sourceCodeStart":567,"sourceCodeEnd":603,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/proxy/cmd/caveman-proxy/main.go#L567-L603","documentation":"runTrial dispatches on the trial subcommand (e.g. promote); any unrecognized subcommand hits the default branch and exits with \"unknown trial subcommand: %s\" naming what was typed. This guards the trial command surface so typos fail fast with a clear message.","triggerScenarios":"Running `caveman-proxy trial <word>` where <word> is not a recognized subcommand — e.g. `caveman-proxy trial list`, `promte`, or `export` if not implemented.","commonSituations":"Typos, guessing subcommand names, or using subcommands from a different caveman-proxy version (feature removed/renamed between releases).","solutions":["Check spelling against supported trial subcommands (e.g. promote).","Run `caveman-proxy trial --help` or without a subcommand to list valid options.","Verify your caveman-proxy version supports the subcommand (upgrade if needed).","Use the exact subcommand name from docs; the CLI has no fuzzy matching."],"exampleFix":"// before\ncaveman-proxy trial promte opt-42 --trial-id t-123\n// after\ncaveman-proxy trial promote opt-42 --trial-id t-123","handlingStrategy":"validation","validationCode":"valid := map[string]bool{\"promote\": true}\nif !valid[sub] {\n    return fmt.Errorf(\"unsupported trial subcommand %q; use promote\", sub)\n}","typeGuard":null,"tryCatchPattern":"if out, err := cmd.Output(); err != nil && strings.Contains(string(out), \"unknown trial subcommand\") {\n    // correct the subcommand name and retry\n}","preventionTips":["Tab-complete or check --help instead of guessing subcommand names.","Pin your scripts to a caveman-proxy version whose subcommands you've verified.","Keep a thin wrapper script exposing only valid subcommands."],"tags":["cli","usage","invalid-subcommand"],"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"}