{"record":{"id":"3e019e5631c1742d","repo":"JuliusBrussee/caveman","slug":"usage-export-has-no-recognizable-token-columns-sa","errorCode":null,"errorMessage":"usage export has no recognizable token columns (saw: %s)","messagePattern":"usage export has no recognizable token columns \\(saw: (.+?)\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"proxy/internal/store/learn_reconcile.go","lineNumber":112,"sourceCode":"\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}\n\traw := strings.TrimSpace(strings.ReplaceAll(record[index], \",\", \"\"))\n\tif raw == \"\" {\n\t\treturn 0\n\t}\n\tvalue, err := strconv.ParseFloat(raw, 64)\n\tif err != nil || value < 0 {\n\t\treturn 0\n\t}\n\treturn int64(value)","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/81536f57b3303b7de7f5bc5b564cc344f9112d68/proxy/internal/store/learn_reconcile.go#L94-L130","documentation":"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.","triggerScenarios":"Thrown at proxy/internal/store/learn_reconcile.go:112 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add the provider's token column names to the input/output/cache_read/cache_write aliases","Export the CSV with at least one recognized token column","Check the printed header list for unexpected column naming"],"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"}