{"record":{"id":"2812924960d4735b","repo":"JuliusBrussee/caveman","slug":"usage-caveman-proxy-trial-promote-optimizer-id","errorCode":null,"errorMessage":"usage: caveman-proxy trial promote <optimizer_id> --trial-id <id>","messagePattern":"usage: caveman-proxy trial promote <optimizer_id> --trial-id <id>","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"proxy/cmd/caveman-proxy/main.go","lineNumber":577,"sourceCode":"\t\t}\n\t\tprintJSON(map[string]any{\"trial_id\": trialID, \"report\": out, \"basis\": plan.Basis})\n\tcase \"export\":\n\t\ttrialID := requiredTrialID(logger, spend, args)\n\t\tplan, err := spend.BuildTrialPlan(trialID)\n\t\tif err != nil {\n\t\t\tfatalJSON(logger, err)\n\t\t}\n\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)","sourceCodeStart":559,"sourceCodeEnd":595,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/proxy/cmd/caveman-proxy/main.go#L559-L595","documentation":"runTrial's \"promote\" subcommand requires a positional optimizer_id argument; when it is missing the CLI exits via fatalJSON with a usage string showing the expected form `caveman-proxy trial promote <optimizer_id> --trial-id <id>`. The --trial-id flag is already parsed earlier via requiredTrialID (which has its own error).","triggerScenarios":"Running `caveman-proxy trial promote --trial-id <id>` without the positional optimizer_id, or running `caveman-proxy trial promote` entirely bare (after trial-id defaulting fails or is supplied).","commonSituations":"Users forget the optimizer id, put it after other flags where the flag parser doesn't pick it up as positional, or copy only the trial id from trial export output.","solutions":["Supply the optimizer_id as the first positional argument after `promote`.","Keep the form: caveman-proxy trial promote <optimizer_id> --trial-id <id>.","Copy the optimizer_id from the trial export/plan output rather than retyping it.","Run `caveman-proxy trial --help` (or read the usage error) to confirm argument order."],"exampleFix":"// before\ncaveman-proxy trial promote --trial-id t-123\n// after\ncaveman-proxy trial promote opt-42 --trial-id t-123","handlingStrategy":"validation","validationCode":"// shell guard\n[ -n \"$1\" ] && [ -n \"$TRIAL_ID\" ] || { echo 'usage: caveman-proxy trial promote <optimizer_id> --trial-id <id>'; exit 2; }","typeGuard":null,"tryCatchPattern":"if err := cmd.Run(); err != nil {\n    if strings.Contains(err.Error(), \"usage: caveman-proxy trial promote\") {\n        // missing optimizer_id — prompt user and re-run\n    }\n}","preventionTips":["Always pass optimizer_id as the first positional after `promote`.","Script wrappers should assert both optimizer_id and --trial-id before exec.","Copy both ids from trial export output to avoid omissions."],"tags":["cli","usage","arguments"],"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"}