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

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.

Source

Thrown at proxy/cmd/caveman-proxy/main.go:749

	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 27d5a3981a)

Solutions

  1. Run a trial first so the store has rows, or pass the id explicitly: --trial-id <id>
  2. Verify CAVEMAN_HOME / the caveman.db path is the same store your trials were written to
  3. If the db was lost, re-run the trial to regenerate it — ids cannot be recovered from nothing

Example fix

# before
caveman-proxy trial export

# after
caveman-proxy trial export --trial-id 2026-08-15-001   # explicit id
caveman-proxy trial export                              # or: run a trial first so LatestTrialID resolves
Defensive patterns

Strategy: validation

Validate before calling

TRIALS=$(caveman-proxy trial export 2>&1) || true
# if it fails with 'no trial runs exist', pass an explicit id or run a trial first

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of JuliusBrussee/caveman@27d5a3981a (2026-08-15). Data as JSON: /api/errors/ac80adab2fc75e34. Report an issue: GitHub.