JuliusBrussee/caveman · error

usage export has no recognizable model column (saw: %s)

Error message

usage export has no recognizable model column (saw: %s)

What it means

Fails-closed schema validation in mapReconcileHeader: after alias matching, no header column matched any known alias for the model field, so the usage CSV cannot be attributed per model. It fires on exports with renamed, translated, or absent model columns.

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 81536f57b3)

Solutions

  1. Add the provider's column name to the model aliases in reconcileColumns
  2. Export the usage CSV with a recognizable model column name
  3. Inspect the printed header list to see what columns were actually present
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at proxy/internal/store/learn_reconcile.go:103 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/c5f99fea5897693a. Report an issue: GitHub.