JuliusBrussee/caveman · error

usage export has no recognizable token columns (saw: %s)

Error message

usage export has no recognizable token columns (saw: %s)

What it means

Fails-closed schema validation in mapReconcileHeader: a model column was found but none of the four token fields (input, output, cache_read, cache_write) matched any header alias, so no token usage can be reconciled.

Source

Thrown at proxy/internal/store/learn_reconcile.go:112

			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
	}
	raw := strings.TrimSpace(strings.ReplaceAll(record[index], ",", ""))
	if raw == "" {
		return 0
	}
	value, err := strconv.ParseFloat(raw, 64)
	if err != nil || value < 0 {
		return 0
	}
	return int64(value)

View on GitHub (pinned to 81536f57b3)

Solutions

  1. Add the provider's token column names to the input/output/cache_read/cache_write aliases
  2. Export the CSV with at least one recognized token column
  3. Check the printed header list for unexpected column naming
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at proxy/internal/store/learn_reconcile.go:112 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of JuliusBrussee/caveman@81536f57b3 (2026-08-27). Data as JSON: /api/errors/3e019e5631c1742d. Report an issue: GitHub.