{"record":{"id":"ac33b24429a06d3b","repo":"babalae/better-genshin-impact","slug":"error-ac33b2","errorCode":null,"errorMessage":"物品原型表缺少表头。","messagePattern":"物品原型表缺少表头。","errorType":"exception","errorClass":"InvalidDataException","httpStatus":null,"severity":"error","filePath":"BetterGenshinImpact/GameTask/CharacterDevelopment/WeaponNameMatcher.cs","lineNumber":182,"sourceCode":"    }\n\n    private static IReadOnlyList<string> LoadWeaponNames()\n    {\n        var path = Global.Absolute(WeaponPrototypePath);\n        if (!File.Exists(path))\n        {\n            throw new FileNotFoundException(\"未找到物品 ONNX 配套表格。\", path);\n        }\n\n        using var parser = new TextFieldParser(path, Encoding.UTF8)\n        {\n            TextFieldType = FieldType.Delimited,\n            HasFieldsEnclosedInQuotes = true,\n            TrimWhiteSpace = false\n        };\n        parser.SetDelimiters(\",\");\n        var headers = parser.ReadFields()\n                      ?? throw new InvalidDataException(\"物品原型表缺少表头。\");\n        var rows = new List<string[]>();\n        while (!parser.EndOfData)\n        {\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            }","sourceCodeStart":164,"sourceCodeEnd":200,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/BetterGenshinImpact/GameTask/CharacterDevelopment/WeaponNameMatcher.cs#L164-L200","documentation":"Thrown as InvalidDataException by LoadWeaponNames when parser.ReadFields() returns null on the very first read (the header row). TextFieldParser.ReadFields returns null only when there is no data to read, meaning item.csv exists but is completely empty (zero bytes or only whitespace).","triggerScenarios":"item.csv exists at the correct path but has zero content or only whitespace/newlines, so ReadFields() cannot produce a header array.","commonSituations":"The asset file was created as an empty placeholder during an interrupted download or build. A git checkout left the file empty due to LFS or sparse-checkout misconfiguration. The file was truncated to zero bytes by a crash during write.","solutions":["Check the file size of item.csv — if it is near-zero bytes, restore it from the repository.","Verify git-lfs or sparse-checkout pulled the file content, not just a pointer.","Rebuild from clean to ensure the asset is properly embedded/copied."],"exampleFix":"null","handlingStrategy":"validation","validationCode":"var info = new FileInfo(path);\nif (!info.Exists || info.Length == 0) { /* file empty or missing — restore */ }","typeGuard":"null","tryCatchPattern":"try { var headers = parser.ReadFields(); }\ncatch (InvalidDataException) { /* empty CSV — restore asset */ }","preventionTips":["Check file size of item.csv after build/deploy as part of CI.","Use git-lfs smudge check to ensure content was fetched."],"tags":["csv-data","empty-file","weapon-matcher"],"backgroundTag":null,"analyzedSha":"a7cb36712dcb409be610257d877fcea3597e9d6b","analyzedAt":"2026-08-13T16:44:57.548Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}