JuliusBrussee/caveman · error
usage export has no recognizable model column
Error message
usage export has no recognizable model column (saw: %s)
What it means
mapReconcileHeader maps a provider usage-export CSV header to canonical fields using fuzzy aliases. If no column matches the known 'model' aliases it fails closed so reconciliation cannot silently mis-attribute tokens, listing the raw header in the message.
Solutions
- Export a usage CSV that includes a model column (any recognized alias: model, Model, model_name, etc.)
- Check the header spelling against the aliases in mapReconcileHeader and fix the CSV
- If it's a new provider naming, add the alias to the model matcher in mapReconcileHeader
Example fix
// before tokens,cost ... // no model column // after model,tokens,cost gpt-4o,1234,0.01
Defensive patterns
Strategy: validation
Validate before calling
header, _ := firstCsvLine(path); if !strings.Contains(strings.ToLower(header), "model") { return fmt.Errorf("usage export missing model column") } Try / catch
if _, err := store.BuildLearnReconcile(ctx, opts); err != nil { if strings.Contains(err.Error(), "no recognizable model column") { log.Error("unsupported export schema; expected a model column, saw: ", headerPart) } } Prevention
- Validate the export header after every download from the provider
- Keep a golden sample CSV and smoke-test parsing in CI
- When providers rename columns, add aliases before shipping
When it happens
Trigger: parseUsageExport reading a CSV whose header row lacks any recognized model column variant (e.g. renamed to something not in the alias list, or header in another language).
Common situations: Provider changed their usage-export column names; hand-made CSV missing a model column; exporting a non-usage report (e.g. invoices) and pointing reconcile at it.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- usage export has no recognizable token columns
- canonical span
- cave_agent_definition_invalid
- cave_context_ir_invalid
- cave_output_schema_mismatch
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/c5f99fea5897693a.
Report an issue: GitHub.
Appendix: source
Thrown at proxy/internal/store/learn_reconcile.go:103
// least one token column is the minimum; anything less cannot be reconciled.
func mapReconcileHeader(header []string) (map[string]int, error) {
found := map[string]int{}
for index, raw := range header {
normalized := normalizeHeader(raw)
for field, aliases := range reconcileColumns {
if _, taken := found[field]; taken {
continue
}
for _, alias := range aliases {
if normalized == normalizeHeader(alias) {
found[field] = index
break
}
}
}
}
if _, ok := found["model"]; !ok {
return nil, fmt.Errorf("usage export has no recognizable model column (saw: %s)", strings.Join(header, ", "))
}
tokenFields := 0
for _, field := range []string{"input", "output", "cache_read", "cache_write"} {
if _, ok := found[field]; ok {
tokenFields++
}
}
if tokenFields == 0 {
return nil, fmt.Errorf("usage export has no recognizable token columns (saw: %s)", strings.Join(header, ", "))
}
return found, nil
}
func reconcileCell(record []string, columns map[string]int, field string) int64 {
index, ok := columns[field]
if !ok || index >= len(record) {
return 0
}View on GitHub (pinned to 3ee70a1026)