{"record":{"id":"ac80adab2fc75e34","repo":"JuliusBrussee/caveman","slug":"no-trial-id-supplied-and-no-trial-runs-exist","errorCode":null,"errorMessage":"no trial_id supplied and no trial runs exist","messagePattern":"no trial_id supplied and no trial runs exist","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"proxy/cmd/caveman-proxy/main.go","lineNumber":749,"sourceCode":"\tspend, err := store.Open(dbPath(home), logger)\n\tif err != nil {\n\t\tlogger.Error(\"cannot open local spend store\", \"error\", err)\n\t\tos.Exit(1)\n\t}\n\treturn spend\n}\n\nfunc requiredTrialID(logger *slog.Logger, spend *store.Store, args []string) string {\n\ttrialID := argFlag(args, \"--trial-id\", \"\")\n\tif trialID != \"\" {\n\t\treturn trialID\n\t}\n\tlatest, err := spend.LatestTrialID()\n\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 {","sourceCodeStart":731,"sourceCodeEnd":767,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/proxy/cmd/caveman-proxy/main.go#L731-L767","documentation":"requiredTrialID found no --trial-id flag and fell back to spend.LatestTrialID(), which returned an empty string — the spend store has no trial runs recorded at all. fatalJSON exits 1. This is the 'you asked me to guess, but there is nothing to guess from' path for trial export/promote.","triggerScenarios":"Running `caveman-proxy trial export` or `trial promote <opt>` with no --trial-id on a fresh ~/.caveman store (or one whose caveman.db has no trial rows). Also when CAVEMAN_HOME points at a new/empty directory so the store is recreated empty.","commonSituations":"First use before any trial was run; CAVEMAN_HOME changed between the machine that ran trials and this one; database file deleted or moved; trial runs exist under a different user's home.","solutions":["Run a trial first so the store has rows, or pass the id explicitly: --trial-id <id>","Verify CAVEMAN_HOME / the caveman.db path is the same store your trials were written to","If the db was lost, re-run the trial to regenerate it — ids cannot be recovered from nothing"],"exampleFix":"# before\ncaveman-proxy trial export\n\n# after\ncaveman-proxy trial export --trial-id 2026-08-15-001   # explicit id\ncaveman-proxy trial export                              # or: run a trial first so LatestTrialID resolves","handlingStrategy":"validation","validationCode":"TRIALS=$(caveman-proxy trial export 2>&1) || true\n# if it fails with 'no trial runs exist', pass an explicit id or run a trial first","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass --trial-id explicitly in automation instead of relying on the latest-trial fallback","Verify CAVEMAN_HOME points at the store that recorded your trials","On a fresh machine/db, run a trial before export/promote"],"tags":["cli","not-found","empty-state","spend-store"],"backgroundTag":null,"analyzedSha":"27d5a3981a347890211bb1bf2439e5c821a63bc9","analyzedAt":"2026-08-15T09:26:11.751Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}