{"record":{"id":"4de9c8aed3ddc07d","repo":"babalae/better-genshin-impact","slug":"charactercard-name-e-message","errorCode":null,"errorMessage":"角色【{characterCard.Name}】卡牌配置解析失败：{e.Message}。请自行进行角色定义","messagePattern":"角色【(.+?)】卡牌配置解析失败：(.+?)。请自行进行角色定义","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"BetterGenshinImpact/GameTask/AutoGeniusInvokation/Config/CharacterCard.cs","lineNumber":132,"sourceCode":"            short skillIndex = 0;\n            for (var i = characterCard.Skills.Count - 1; i >= 0; i--)\n            {\n                var skillsItem = characterCard.Skills[i];\n                if (skillsItem.SkillTag.Contains(\"被动技能\"))\n                {\n                    continue;\n                }\n\n                skillIndex++;\n\n                source.Skills[skillIndex] = GetSkill(skillsItem);\n                source.Skills[skillIndex].Index = skillIndex;\n            }\n        }\n        catch (System.Exception e)\n        {\n            TaskControl.Logger.LogError($\"角色【{characterCard.Name}】卡牌配置解析失败：{e.Message}\");\n            throw new System.Exception($\"角色【{characterCard.Name}】卡牌配置解析失败：{e.Message}。请自行进行角色定义\", e);\n        }\n    }\n\n    public static Skill GetSkill(SkillsItem skillsItem)\n    {\n        Skill skill = new()\n        {\n            Name = skillsItem.Name\n        };\n        var specificElementNum = 0;\n        foreach (var cost in skillsItem.Cost)\n        {\n            if (cost.NameEn == \"unaligned_element\")\n            {\n                skill.AnyElementCost = cost.Count;\n            }\n            else if (cost.NameEn == \"energy\")\n            {","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/BetterGenshinImpact/GameTask/AutoGeniusInvokation/Config/CharacterCard.cs#L114-L150","documentation":"Thrown by CharacterCard.CopyCardProperty when an exception occurs during TCG character card property parsing — converting element strings, copying HP, or parsing skill data via GetSkill. The inner exception (e) is wrapped with the character name and re-thrown. This is a data-integrity error in the built-in TCG character card configuration.","triggerScenarios":"CopyCardProperty processes a CharacterCard (from JSON card data) and fails during: element string parsing (ChineseToElementalType), skill cost parsing (ToElementalType on cost.NameEn), or the GetSkill validation that requires exactly one specific element per skill. The inner exception is typically '技能[...]默认技能数据技能解析失败' from GetSkill when specificElementNum != 1.","commonSituations":"This is an internal data error in the bundled character card configuration JSON. It triggers when card data has unexpected cost structures (e.g., a skill with 0 or 2+ specific element costs instead of exactly 1), missing or malformed element strings, or version mismatches between the card data and the parsing logic. End users see this when the TCG auto-play feature starts and fails to load a character definition.","solutions":["Check the inner exception message (e.Message) for the root cause — often 'specificElementNum != 1' from GetSkill.","If this is bundled data, report the issue with the character name from the message.","For custom card data, ensure each non-passive skill has exactly one specific element cost entry and one optional 'unaligned_element' cost.","Verify the element string format (e.g., '冰元素' or '冰') matches what ChineseToElementalType expects."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try\n{\n    CharacterCard.CopyCardProperty(source, characterCard);\n}\ncatch (Exception e) when (e.Message.Contains(\"卡牌配置解析失败\"))\n{\n    TaskControl.Logger.LogWarning(\"角色卡牌配置解析失败，跳过该角色: {Msg}\", e.Message);\n    // The message suggests '请自行进行角色定义' — use custom character definition\n}","preventionTips":["This is primarily an internal data error — ensure the bundled card configuration JSON is up to date.","If using custom card data, verify each non-passive skill has exactly one specific element cost.","The inner exception message (e.InnerException.Message) gives the root cause — inspect it.","Report bundled-data issues with the character name from the error message."],"tags":["tcg","auto-genius-invokation","card-config","data-error","parsing"],"backgroundTag":null,"analyzedSha":"a7cb36712dcb409be610257d877fcea3597e9d6b","analyzedAt":"2026-08-13T16:44:57.548Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}