JuliusBrussee/caveman · error
invalid --since (want RFC3339)
Error message
invalid --since %q (want RFC3339): %w
What it means
ObserveSummarySince accepts an optional RFC3339 timestamp; if the provided string is non-empty and fails time.Parse(time.RFC3339, ...), the summary is not computed and this error reports the offending value. The --since flag value must be a strict RFC3339 timestamp.
Solutions
- Use full RFC3339 form: 2024-01-15T10:00:00Z (include the T and timezone offset).
- If parsing user input, accept flexible formats and reformat to RFC3339 before calling.
- Omit the argument entirely (empty string) for an all-time summary.
- Pre-validate with time.Parse(time.RFC3339, v) in the CLI layer to give a friendlier message.
Example fix
// before
summary, err := store.ObserveSummarySince("2024-01-15 10:00:00")
// after
summary, err := store.ObserveSummarySince("2024-01-15T10:00:00Z") Defensive patterns
Strategy: validation
Validate before calling
func validSince(v string) bool {
v = strings.TrimSpace(v)
if v == "" { return true }
_, err := time.Parse(time.RFC3339, v)
return err == nil
} Try / catch
summary, err := store.ObserveSummarySince(since)
if err != nil && strings.Contains(err.Error(), "invalid --since") {
return fmt.Errorf("--since must be RFC3339, e.g. 2024-01-15T10:00:00Z")
} Prevention
- Always include the T separator and timezone offset (Z or ±hh:mm).
- Pre-validate --since in flag parsing with time.Parse(time.RFC3339, ...).
- Provide an example timestamp in --help text.
When it happens
Trigger: Calling Store.ObserveSummarySince("2024/01/15") or any non-RFC3339 string — missing timezone (e.g. "2024-01-15 10:00:00"), using slashes, or passing 'yesterday'.
Common situations: Users type --since with a human-friendly date format, omit the Z/offset, or shell-quote issues drop part of the timestamp.
Related errors
- at least one report path and the canonical span fixture…
- at least one sink id is required
- base and head must be full Git object IDs
- cave_live_eval_sandbox_profile_invalid
- caveman agent: entry must export default agent()
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/aabfa526b9b0d580.
Report an issue: GitHub.
Appendix: source
Thrown at proxy/internal/store/store.go:844
out.Basis = "inferred"
return out, nil
}
// ObserveSummarySince returns the compact observe-estimate object, optionally
// filtered to rows at or after an RFC3339 instant (the wrap session start). It
// mixes the observe-only would-have-saved numbers with the real compression cut so
// one call serves both the "would have cut" (observe) and "cut" (compress) session
// lines. Everything it reports is `inferred`; savings_usd is whatever was truly
// booked (0 in observe mode), and would_save_usd stays nil unless a priced row
// produced one.
func (s *Store) ObserveSummarySince(since string) (ObserveSummary, error) {
out := ObserveSummary{Basis: "inferred", TokenAccounting: map[string]int64{}}
where := ""
var args []any
if trimmed := strings.TrimSpace(since); trimmed != "" {
t, err := time.Parse(time.RFC3339, trimmed)
if err != nil {
return out, fmt.Errorf("invalid --since %q (want RFC3339): %w", trimmed, err)
}
where = " WHERE ts >= ?"
args = append(args, t.UTC().Format(storeTSLayout))
}
var usdCount int64
var usdSum float64
row := s.db.QueryRow(`SELECT COUNT(*), COALESCE(SUM(input_tokens),0), COALESCE(SUM(would_save_tokens),0),
COALESCE(SUM(compression_tokens_before),0), COALESCE(SUM(compression_tokens_after),0),
COALESCE(SUM(compression_tokens_before - compression_tokens_after),0),
COALESCE(SUM(savings_usd),0), COUNT(would_save_usd), COALESCE(SUM(would_save_usd),0),
COALESCE(SUM(cached_input_tokens),0), COALESCE(SUM(cache_creation_input_tokens),0),
COALESCE(SUM(CASE WHEN cache_bust <> 0 THEN 1 ELSE 0 END),0),
COALESCE(SUM(CASE WHEN compression_eligible <> 0 THEN 1 ELSE 0 END),0)
FROM requests`+where, args...)
if err := row.Scan(&out.Spans, &out.TokensIn, &out.WouldSaveTokens,
&out.CompressionTokensBefore, &out.CompressionTokensAfter, &out.CompressionTokensSaved,
&out.SavingsUSD, &usdCount, &usdSum,
&out.CachedInputTokens, &out.CacheCreationInputTokens,View on GitHub (pinned to 3ee70a1026)