JuliusBrussee/caveman · error
no trial_id supplied and no trial runs exist
Error message
no trial_id supplied and no trial runs exist
What it means
This error comes from the caveman-proxy CLI's requiredTrialID helper (proxy/cmd/caveman-proxy/main.go:931). Trial subcommands need a trial_id; if --trial-id is not given, the helper falls back to the most recent trial recorded in the local SQLite spend store. When no --trial-id flag was passed AND the spend store has never recorded any trial run, it exits with this fatal error because there is no sensible default trial to operate on.
Solutions
- Run a trial first (the command that records trial runs) so LatestTrialID() returns a value
- Pass the trial explicitly: add --trial-id <id> to the command
- Check that ~/.caveman/caveman.db is the store you expect (HOME differences in cron/CI) and contains trial runs
- Verify the flag spelling is --trial-id; a misspelled flag makes requiredTrialID fall through to the empty store
Example fix
// before caveman-proxy trial promote --optimizer my-opt // after caveman-proxy trial promote --trial-id 2026-09-20-a --optimizer my-opt
Defensive patterns
Strategy: validation
Validate before calling
trialID := argFlag(args, "--trial-id", "")
if trialID == "" {
if latest, _ := spend.LatestTrialID(); latest == "" {
return fmt.Errorf("no trial available: run a trial first or pass --trial-id")
}
} Prevention
- Always pass --trial-id explicitly in scripts/CI instead of relying on the latest-run fallback
- Run the trial-recording command before any trial promote/report command
- Pin HOME in cron/CI so the correct ~/.caveman/caveman.db is consulted
- List existing trial ids first when unsure
When it happens
Trigger: Running a trial subcommand (via runTrial, e.g. trial plan/promote/report) without --trial-id on a machine whose ~/.caveman/caveman.db contains zero trial rows — either a fresh install or a database where no trial was ever started.
Common situations: Fresh install of caveman-proxy where the user jumps straight to a trial promote/report command; cleared or recreated spend store; typo'd flag name (--trialid vs --trial-id) so the fallback lookup runs and finds nothing; copying commands from docs to a new workstation.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- optimizer not found in trial
- usage: caveman-proxy learn applied
- usage: caveman-proxy learn apply
- usage: caveman-proxy learn simulate
- usage: caveman-proxy usage import codex|claude
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/ac80adab2fc75e34.
Report an issue: GitHub.
Appendix: source
Thrown at proxy/cmd/caveman-proxy/main.go:931
spend, err := store.Open(dbPath(home), logger)
if err != nil {
logger.Error("cannot open local spend store", "error", err)
os.Exit(1)
}
return spend
}
func requiredTrialID(logger *slog.Logger, spend *store.Store, args []string) string {
trialID := argFlag(args, "--trial-id", "")
if trialID != "" {
return trialID
}
latest, err := spend.LatestTrialID()
if err != nil {
fatalJSON(logger, err)
}
if latest == "" {
fatalJSON(logger, fmt.Errorf("no trial_id supplied and no trial runs exist"))
}
return latest
}
func promoteMove(logger *slog.Logger, home, trialID, optimizerID string, plan store.TrialPlan) {
var move store.TrialMove
for _, candidate := range plan.Moves {
if candidate.OptimizerID == optimizerID {
move = candidate
break
}
}
if move.OptimizerID == "" {
fatalJSON(logger, fmt.Errorf("optimizer %q not found in trial %s", optimizerID, trialID))
}
if move.Status != "safe_now" || !(strings.HasPrefix(move.SafetyClass, "S0_") || strings.HasPrefix(move.SafetyClass, "S1_")) {
path := filepath.Join(home, "reports", "caveman-trial-"+trialID+"-"+optimizerID+"-candidate.yaml")
if err := os.MkdirAll(filepath.Dir(path), 0o700); err != nil {View on GitHub (pinned to 3ee70a1026)