{"record":{"id":"e6c7db6f0452fb7a","repo":"babalae/better-genshin-impact","slug":"columnname","errorCode":null,"errorMessage":"物品原型表缺少必需列 {columnName}。","messagePattern":"物品原型表缺少必需列 (.+?)。","errorType":"exception","errorClass":"InvalidDataException","httpStatus":null,"severity":"error","filePath":"BetterGenshinImpact/GameTask/CharacterDevelopment/WeaponNameMatcher.cs","lineNumber":203,"sourceCode":"        {\n            rows.Add(parser.ReadFields()\n                     ?? throw new InvalidDataException(\"物品原型表存在无法读取的记录。\"));\n        }\n\n        return ExtractWeaponNames(headers, rows);\n    }\n\n    private static int FindRequiredColumn(IReadOnlyList<string> headers, string columnName)\n    {\n        for (var i = 0; i < headers.Count; i++)\n        {\n            if (string.Equals(headers[i].Trim(), columnName, StringComparison.OrdinalIgnoreCase))\n            {\n                return i;\n            }\n        }\n\n        throw new InvalidDataException($\"物品原型表缺少必需列 {columnName}。\");\n    }\n}\n","sourceCodeStart":185,"sourceCodeEnd":206,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/BetterGenshinImpact/GameTask/CharacterDevelopment/WeaponNameMatcher.cs#L185-L206","documentation":"Thrown as InvalidDataException by FindRequiredColumn when neither 'item_class_id' nor 'item_name' (case-insensitive, trimmed) is found among the CSV headers. The extractor needs both columns to locate weapon records and their names. Without them it cannot determine which column holds the class id or the name.","triggerScenarios":"The item.csv header row does not contain columns named 'item_class_id' and/or 'item_name', either because the file is a different CSV variant, the column was renamed, or the header uses different casing/whitespace that does not match the OrdinalIgnoreCase comparison.","commonSituations":"A wrong CSV file was placed at the item.csv path (e.g., a material-only export). A game data update renamed columns. The CSV uses a different locale naming convention for headers.","solutions":["Open item.csv and verify the header row contains 'item_class_id' and 'item_name' exactly (case-insensitive).","If the column names changed, update WeaponNameMatcher.FindRequiredColumn or rename the CSV headers.","Restore the correct item.csv from the project's bundled assets."],"exampleFix":"null","handlingStrategy":"validation","validationCode":"var hasClassId = headers.Any(h => string.Equals(h.Trim(), \"item_class_id\", StringComparison.OrdinalIgnoreCase));\nvar hasName = headers.Any(h => string.Equals(h.Trim(), \"item_name\", StringComparison.OrdinalIgnoreCase));\nif (!hasClassId || !hasName) { /* abort: schema mismatch */ }","typeGuard":"null","tryCatchPattern":"try { FindRequiredColumn(headers, \"item_class_id\"); }\ncatch (InvalidDataException ex) { /* log missing column, restore correct CSV */ }","preventionTips":["Pin item.csv to a known-good version and version-control it.","Add schema validation tests that assert required columns exist."],"tags":["csv-data","weapon-matcher","schema-mismatch"],"backgroundTag":null,"analyzedSha":"a7cb36712dcb409be610257d877fcea3597e9d6b","analyzedAt":"2026-08-13T16:44:57.548Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}