{"record":{"id":"14312572bcd89160","repo":"JuliusBrussee/caveman","slug":"optimizer-q-not-found-in-trial-s","errorCode":null,"errorMessage":"optimizer %q not found in trial %s","messagePattern":"optimizer %q not found in trial (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"proxy/cmd/caveman-proxy/main.go","lineNumber":763,"sourceCode":"\tif err != nil {\n\t\tfatalJSON(logger, err)\n\t}\n\tif latest == \"\" {\n\t\tfatalJSON(logger, fmt.Errorf(\"no trial_id supplied and no trial runs exist\"))\n\t}\n\treturn latest\n}\n\nfunc promoteMove(logger *slog.Logger, home, trialID, optimizerID string, plan store.TrialPlan) {\n\tvar move store.TrialMove\n\tfor _, candidate := range plan.Moves {\n\t\tif candidate.OptimizerID == optimizerID {\n\t\t\tmove = candidate\n\t\t\tbreak\n\t\t}\n\t}\n\tif move.OptimizerID == \"\" {\n\t\tfatalJSON(logger, fmt.Errorf(\"optimizer %q not found in trial %s\", optimizerID, trialID))\n\t}\n\tif move.Status != \"safe_now\" || !(strings.HasPrefix(move.SafetyClass, \"S0_\") || strings.HasPrefix(move.SafetyClass, \"S1_\")) {\n\t\tpath := filepath.Join(home, \"reports\", \"caveman-trial-\"+trialID+\"-\"+optimizerID+\"-candidate.yaml\")\n\t\tif err := os.MkdirAll(filepath.Dir(path), 0o700); err != nil {\n\t\t\tfatalJSON(logger, err)\n\t\t}\n\t\traw, _ := yaml.Marshal(map[string]any{\n\t\t\t\"mode\":         \"record\",\n\t\t\t\"optimizers\":   map[string]bool{optimizerID: true},\n\t\t\t\"eval_command\": \"caveman evals run\",\n\t\t})\n\t\tif err := os.WriteFile(path, raw, 0o600); err != nil {\n\t\t\tfatalJSON(logger, err)\n\t\t}\n\t\tprintJSON(map[string]any{\n\t\t\t\"trial_id\": trialID, \"optimizer_id\": optimizerID, \"promoted\": false,\n\t\t\t\"candidate_config\": path, \"eval_command\": \"caveman evals run\",\n\t\t\t\"reason\": \"move is not safe_now S0/S1\",","sourceCodeStart":745,"sourceCodeEnd":781,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/proxy/cmd/caveman-proxy/main.go#L745-L781","documentation":"promoteMove searched the trial plan's Moves for the given optimizer_id and found no candidate with that OptimizerID. The plan comes from BuildTrialPlan(trialID) computed in this invocation, so the optimizer must be part of that trial's current plan. fatalJSON exits 1 before any candidate file is written.","triggerScenarios":"Passing an optimizer id that belongs to a different trial, a typo/case mismatch, or an id from an older plan revision where the optimizer was renamed or dropped (e.g. heuristics that no longer emit retired ids like model-right-sizing).","commonSituations":"Copy-pasting optimizer ids across trials; plans regenerated after a binary upgrade with changed heuristics; retired optimizer ids lingering in notes or scripts.","solutions":["Inspect the trial plan first: caveman-proxy trial export --trial-id <id> lists the Moves with their optimizer ids — copy the id exactly from there","Confirm the optimizer id belongs to this trial, not another","If the id vanished after an upgrade, re-run the trial under the current binary so the plan reflects live heuristics"],"exampleFix":"# before\ncaveman-proxy trial promote model-right-sizing --trial-id abc123\n\n# after\ncaveman-proxy trial export --trial-id abc123          # see valid Moves\ncaveman-proxy trial promote compress-prefix --trial-id abc123","handlingStrategy":"validation","validationCode":"OPT_IDS=$(caveman-proxy trial export --trial-id \"$TRIAL_ID\" | jq -r '.moves[].optimizer_id')\necho \"$OPT_IDS\" | grep -qx \"$OPT_ID\" || { echo \"invalid optimizer id\" >&2; exit 2; }\ncaveman-proxy trial promote \"$OPT_ID\" --trial-id \"$TRIAL_ID\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always read optimizer ids from the same trial's exported plan","Ids are exact-match and trial-scoped — never reuse them across trials","After binary upgrades, re-run the trial: retired heuristics drop ids from new plans"],"tags":["cli","not-found","trial-plan","stale-state"],"backgroundTag":null,"analyzedSha":"27d5a3981a347890211bb1bf2439e5c821a63bc9","analyzedAt":"2026-08-15T09:26:11.751Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}