{"record":{"id":"2f5def527a6d676a","repo":"JuliusBrussee/caveman","slug":"usage-export-row-w","errorCode":null,"errorMessage":"usage export row: %w","messagePattern":"usage export row: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"proxy/internal/store/learn_reconcile.go","lineNumber":157,"sourceCode":"\tdefer file.Close()\n\treader := csv.NewReader(file)\n\treader.FieldsPerRecord = -1\n\theader, err := reader.Read()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"usage export has no header row: %w\", err)\n\t}\n\tcolumns, err := mapReconcileHeader(header)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbilled := map[string]int64{}\n\tfor {\n\t\trecord, err := reader.Read()\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"usage export row: %w\", err)\n\t\t}\n\t\tmodelIndex := columns[\"model\"]\n\t\tif modelIndex >= len(record) {\n\t\t\tcontinue\n\t\t}\n\t\tmodel := strings.TrimSpace(record[modelIndex])\n\t\tif model == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\ttotal := reconcileCell(record, columns, \"input\") +\n\t\t\treconcileCell(record, columns, \"output\") +\n\t\t\treconcileCell(record, columns, \"cache_read\") +\n\t\t\treconcileCell(record, columns, \"cache_write\")\n\t\tif total <= 0 {\n\t\t\tcontinue\n\t\t}\n\t\tbilled[model] += total\n\t}","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/81536f57b3303b7de7f5bc5b564cc344f9112d68/proxy/internal/store/learn_reconcile.go#L139-L175","documentation":"parseUsageExport hit a CSV-level read error (other than EOF) while iterating rows of the usage export file — malformed quoting, inconsistent field counts, or mid-file corruption. The wrapped error carries csv.Reader's detail identifying the offending row.","triggerScenarios":"Thrown at proxy/internal/store/learn_reconcile.go:157 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the CSV around the failing row for quoting or delimiter problems","Re-export the usage CSV from the provider","Fix the specific row indicated by the wrapped csv error's line number"],"exampleFix":null,"handlingStrategy":"fallback","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"}