JuliusBrussee/caveman · error
trial_id is required
Error message
trial_id is required
What it means
StartTrial records the start of a trial run keyed by trial_id; an empty trial_id is rejected outright since every trial row is identified by it. The insert upserts agent_slug and command for the given trial.
Solutions
- Generate or pass a non-empty trial ID before calling StartTrial (e.g. UUID or slug).
- In the CLI path, require the trial-id flag and fail with a clear usage message if absent.
- Add a caller-side guard: if trialID == "" { return errors.New("trial id required") }.
- If the ID derives from another value, check why that source was empty.
Example fix
// before
err := store.StartTrial(trialID, agentSlug, cmd) // trialID may be ""
// after
if trialID == "" { trialID = uuid.NewString() }
err := store.StartTrial(trialID, agentSlug, cmd) Defensive patterns
Strategy: validation
Validate before calling
if trialID == "" {
return errors.New("--trial-id is required to start a trial")
} Try / catch
if err := store.StartTrial(trialID, slug, cmd); err != nil {
if err.Error() == "trial_id is required" {
return fmt.Errorf("generate a trial id before starting the trial")
}
return err
} Prevention
- Generate a UUID/slug trial ID at entry point if not supplied.
- Make --trial-id a required flag in the trial command.
- Assert trialID != "" in tests around StartTrial.
When it happens
Trigger: Calling Store.StartTrial("", agentSlug, command) — the trial ID argument was empty or a variable that failed to be populated before the call.
Common situations: The CLI wrapper (runTrial) did not receive --trial-id, or the caller generated the ID conditionally and the branch producing it was skipped.
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
- apiKey, baseURL, and agent are required
- arm must be or
- artifact_id is required
- artifactId is required
- ASGI context resolver or request bounds are invalid
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/4a2108fc76b186b5.
Report an issue: GitHub.
Appendix: source
Thrown at proxy/internal/store/trial_store.go:61
func (s *Store) RecordPayload(label, requestID, traceID string, body []byte) {
trialID := strings.TrimPrefix(label, "trial:")
if trialID == "" || trialID == label {
return
}
_, err := s.db.Exec(
`INSERT OR IGNORE INTO trial_payloads
(trial_id, request_id, trace_id, ts, request_bytes, raw_request)
VALUES (?, ?, ?, ?, ?, ?)`,
trialID, requestID, traceID, time.Now().UTC().Format(time.RFC3339), len(body), append([]byte(nil), body...),
)
if err != nil && s.logger != nil {
s.logger.Warn("local trial payload insert failed", "error", err, "request_id", requestID)
}
}
func (s *Store) StartTrial(trialID, agentSlug, command string) error {
if trialID == "" {
return fmt.Errorf("trial_id is required")
}
_, err := s.db.Exec(
`INSERT INTO trial_runs (trial_id, agent_slug, command, started_at)
VALUES (?, ?, ?, ?)
ON CONFLICT(trial_id) DO UPDATE SET
agent_slug = excluded.agent_slug,
command = excluded.command`,
trialID, agentSlug, command, time.Now().UTC().Format(time.RFC3339),
)
return err
}
func (s *Store) FinishTrial(trialID string, exitCode int) error {
if trialID == "" {
return fmt.Errorf("trial_id is required")
}
_, err := s.db.Exec(
`UPDATE trial_runs SET ended_at = ?, exit_code = ? WHERE trial_id = ?`,View on GitHub (pinned to 3ee70a1026)