{"record":{"id":"79d13289a770817b","repo":"babalae/better-genshin-impact","slug":"item-class-id-weapon","errorCode":null,"errorMessage":"物品原型表中没有 item_class_id 以 weapon: 开头的武器记录。","messagePattern":"物品原型表中没有 item_class_id 以 weapon: 开头的武器记录。","errorType":"exception","errorClass":"InvalidDataException","httpStatus":null,"severity":"error","filePath":"BetterGenshinImpact/GameTask/CharacterDevelopment/WeaponNameMatcher.cs","lineNumber":115,"sourceCode":"            {\n                throw new InvalidDataException(\"物品原型表存在列数不足的记录。\");\n            }\n\n            if (!columns[itemClassIdIndex].Trim().StartsWith(\"weapon:\", StringComparison.OrdinalIgnoreCase))\n            {\n                continue;\n            }\n\n            var name = columns[itemNameIndex].Trim();\n            if (!string.IsNullOrWhiteSpace(name))\n            {\n                names.Add(name);\n            }\n        }\n\n        if (names.Count == 0)\n        {\n            throw new InvalidDataException(\"物品原型表中没有 item_class_id 以 weapon: 开头的武器记录。\");\n        }\n\n        return names.OrderBy(name => name, StringComparer.Ordinal).ToArray();\n    }\n\n    /// <summary>\n    /// 计算两个字符串的 Levenshtein 编辑距离。\n    /// </summary>\n    /// <remarks>仅保留两行动态规划状态，额外空间复杂度为 O(min(m,n))。</remarks>\n    internal static int LevenshteinDistance(string source, string target)\n    {\n        if (source.Length == 0)\n        {\n            return target.Length;\n        }\n\n        if (target.Length == 0)\n        {","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/BetterGenshinImpact/GameTask/CharacterDevelopment/WeaponNameMatcher.cs#L97-L133","documentation":"Thrown by ExtractWeaponNames after iterating all rows when no entry had an item_class_id starting with 'weapon:'. The matcher relies entirely on this filtered set; without weapon records it cannot perform any name correction. This signals the item.csv is the wrong file, an outdated version, or a different-language export that uses a different class-id scheme.","triggerScenarios":"item.csv loads and parses correctly but every row's item_class_id starts with a non-weapon prefix (e.g., 'material:', 'food:'), or the column value format changed in a game data update.","commonSituations":"Using a custom or community-curated item.csv that omits weapons. A Genshin Impact data version change altered the item_class_id naming convention. The wrong CSV was placed at Assets/Model/ItemV2/item.csv.","solutions":["Verify the item.csv at Assets/Model/ItemV2/ is the original bundled file that includes weapon rows.","Check that item_class_id values in the CSV actually contain entries prefixed with 'weapon:'.","Restore the asset from a known-good release of the project."],"exampleFix":"null","handlingStrategy":"validation","validationCode":"var hasWeaponRows = rows.Any(r => r[itemClassIdIndex].Trim().StartsWith(\"weapon:\", StringComparison.OrdinalIgnoreCase));\nif (!hasWeaponRows) { /* abort: wrong CSV */ }","typeGuard":"null","tryCatchPattern":"try { var names = ExtractWeaponNames(headers, rows); }\ncatch (InvalidDataException) { /* no weapon data — restore correct item.csv */ }","preventionTips":["Confirm item.csv is the original project asset that includes weapon: entries.","Run a data-integrity smoke test after any asset update."],"tags":["csv-data","weapon-matcher","data-validation"],"backgroundTag":null,"analyzedSha":"a7cb36712dcb409be610257d877fcea3597e9d6b","analyzedAt":"2026-08-13T16:44:57.548Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}