{"record":{"id":"c5f99fea5897693a","repo":"JuliusBrussee/caveman","slug":"usage-export-has-no-recognizable-model-column-saw","errorCode":null,"errorMessage":"usage export has no recognizable model column (saw: %s)","messagePattern":"usage export has no recognizable model column \\(saw: (.+?)\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"proxy/internal/store/learn_reconcile.go","lineNumber":103,"sourceCode":"// least one token column is the minimum; anything less cannot be reconciled.\nfunc mapReconcileHeader(header []string) (map[string]int, error) {\n\tfound := map[string]int{}\n\tfor index, raw := range header {\n\t\tnormalized := normalizeHeader(raw)\n\t\tfor field, aliases := range reconcileColumns {\n\t\t\tif _, taken := found[field]; taken {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor _, alias := range aliases {\n\t\t\t\tif normalized == normalizeHeader(alias) {\n\t\t\t\t\tfound[field] = index\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif _, ok := found[\"model\"]; !ok {\n\t\treturn nil, fmt.Errorf(\"usage export has no recognizable model column (saw: %s)\", strings.Join(header, \", \"))\n\t}\n\ttokenFields := 0\n\tfor _, field := range []string{\"input\", \"output\", \"cache_read\", \"cache_write\"} {\n\t\tif _, ok := found[field]; ok {\n\t\t\ttokenFields++\n\t\t}\n\t}\n\tif tokenFields == 0 {\n\t\treturn nil, fmt.Errorf(\"usage export has no recognizable token columns (saw: %s)\", strings.Join(header, \", \"))\n\t}\n\treturn found, nil\n}\n\nfunc reconcileCell(record []string, columns map[string]int, field string) int64 {\n\tindex, ok := columns[field]\n\tif !ok || index >= len(record) {\n\t\treturn 0\n\t}","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/81536f57b3303b7de7f5bc5b564cc344f9112d68/proxy/internal/store/learn_reconcile.go#L85-L121","documentation":"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.","triggerScenarios":"Thrown at proxy/internal/store/learn_reconcile.go:103 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add the provider's column name to the model aliases in reconcileColumns","Export the usage CSV with a recognizable model column name","Inspect the printed header list to see what columns were actually present"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"81536f57b3303b7de7f5bc5b564cc344f9112d68","analyzedAt":"2026-08-27T02:25:50.681Z","contentChangedAt":"2026-08-27T02:25:50.681Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}