JuliusBrussee/caveman · error
usage export contained no priced rows
Error message
usage export contained no priced rows
What it means
parseUsageExport reads a usage export CSV, accumulates billed cost per model, and skips rows whose computed total is <= 0. If, after that filtering, no priced rows remain, it refuses to return an empty map and fails closed so BuildLearnReconcile never reconciles against an empty baseline. The library treats 'export parsed but nothing billable in it' as an error rather than silently producing a meaningless reconcile.
Solutions
- Open the export file and confirm it actually contains priced rows (a cost/total column with values > 0) for the requested window
- Re-export usage from the provider with a date range that includes billable requests
- Check the provider's export schema for renamed columns (header variants) and update parsing expectations
- If the export is legitimately empty for the window, widen the window rather than expecting a reconcile result
Example fix
// before
plan, err := store.BuildLearnReconcile(cwd, "empty-export.csv", sources, since)
// after
if err != nil {
return fmt.Errorf("learn reconcile needs a non-empty priced export: %w", err)
} Defensive patterns
Strategy: validation
Validate before calling
rows, err := readCSVRows(exportPath)
if err != nil { return err }
priced := 0
for _, r := range rows[1:] {
if total, err := computeRowTotal(r); err == nil && total > 0 { priced++ }
}
if priced == 0 { return fmt.Errorf("export %s has no priced rows; re-export a window with billable traffic", exportPath) } Prevention
- Peek at the export CSV before reconciling and assert at least one row has a positive cost
- Re-export from the provider after schema changes and diff headers
- Pin the provider export format version used by your pipeline
- Log a warning when an export window yields zero billable rows
When it happens
Trigger: Calling BuildLearnReconcile with an export file whose rows all produce total <= 0 (zero prices, unknown schema columns yielding zero totals, or an export containing only header/unpriced rows). Also produced directly by tests TestReconcileFailsClosedOnUnknownSchema and TestReconcileAcceptsProviderHeaderVariants.
Common situations: Pointing the CLI at a stale, truncated, or wrong-format usage export; a provider changed its CSV column names so cost parsing yields 0 for every row; exporting a date window with no billable traffic; forgetting that transcript-only rows without pricing are skipped.
Understand the failure class
Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.
Related errors
- usage export has no recognizable model column
- usage export has no recognizable token columns
- apiKey, baseURL, and agent are required
- arm must be or
- artifact_id is required
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/d5b3571c34938f62.
Report an issue: GitHub.
Appendix: source
Thrown at proxy/internal/store/learn_reconcile.go:177
modelIndex := columns["model"]
if modelIndex >= len(record) {
continue
}
model := strings.TrimSpace(record[modelIndex])
if model == "" {
continue
}
total := reconcileCell(record, columns, "input") +
reconcileCell(record, columns, "output") +
reconcileCell(record, columns, "cache_read") +
reconcileCell(record, columns, "cache_write")
if total <= 0 {
continue
}
billed[model] += total
}
if len(billed) == 0 {
return nil, fmt.Errorf("usage export contained no priced rows")
}
return billed, nil
}
// BuildLearnReconcile compares an export against the scanned window.
func (s *Store) BuildLearnReconcile(cwd, exportPath string, sources []string, sinceExpr string) (LearnReconcile, error) {
billed, err := parseUsageExport(exportPath)
if err != nil {
return LearnReconcile{}, err
}
plan, err := s.BuildLearnPlan(cwd, sources, sinceExpr)
if err != nil {
return LearnReconcile{}, err
}
return buildLearnReconcile(billed, plan.Spend, exportPath), nil
}
func buildLearnReconcile(billed map[string]int64, spend *LearnSpend, source string) LearnReconcile {View on GitHub (pinned to 3ee70a1026)