{"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":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"proxy/cmd/caveman-proxy/main.go","lineNumber":945,"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":927,"sourceCodeEnd":963,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/proxy/cmd/caveman-proxy/main.go#L927-L963","documentation":"promoteMove (proxy/cmd/caveman-proxy/main.go:945) searches the trial plan's Moves for an entry whose OptimizerID matches the requested optimizer. If no move matches, the zero-value move has an empty OptimizerID and the command aborts with this error. It means the optimizer id does not exist in the given trial's plan — a lookup failure, not a state problem.","triggerScenarios":"Calling the trial promote flow (runTrial → promoteMove) with --optimizer <id> where <id> is not one of the OptimizerID values in the stored TrialPlan for the supplied --trial-id.","commonSituations":"Typo or casing mismatch in the optimizer id; referencing an optimizer from a different trial's plan; the trial plan was regenerated and the optimizer id changed; stale docs listing an old optimizer id.","solutions":["List the trial plan's moves (e.g. the trial report/plan command) and copy an exact OptimizerID","Double-check --trial-id points at the trial that actually contains this optimizer","Re-run the trial plan build if the plan was regenerated and the id no longer exists","Check for typos/case differences in the optimizer identifier"],"exampleFix":"// before\ncaveman-proxy trial promote --trial-id 2026-09-20-a --optimizer compress-0pt\n// after (id that exists in the plan)\ncaveman-proxy trial promote --trial-id 2026-09-20-a --optimizer context-compress.v1","handlingStrategy":"validation","validationCode":"plan, err := store.LoadTrialPlan(home, trialID)\nif err != nil { return err }\nfound := false\nfor _, m := range plan.Moves {\n    if m.OptimizerID == optimizerID { found = true; break }\n}\nif !found {\n    return fmt.Errorf(\"optimizer %q not in trial %s; available: %v\", optimizerID, trialID, idsOf(plan.Moves))\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Copy optimizer ids from the trial plan output verbatim instead of retyping","Confirm --trial-id matches the trial that produced the optimizer","Keep the trial plan report open when promoting moves","Watch for regenerated plans changing optimizer ids"],"tags":["cli","not-found","trial","optimizer"],"backgroundTag":"entity-not-found","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"}