babalae/better-genshin-impact · error · Exception
角色【{characterCard.Name}】卡牌配置解析失败:{e.Message}。请自行进行角色定义
Error message
角色【{characterCard.Name}】卡牌配置解析失败:{e.Message}。请自行进行角色定义 What it means
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.
Source
Thrown at BetterGenshinImpact/GameTask/AutoGeniusInvokation/Config/CharacterCard.cs:132
short skillIndex = 0;
for (var i = characterCard.Skills.Count - 1; i >= 0; i--)
{
var skillsItem = characterCard.Skills[i];
if (skillsItem.SkillTag.Contains("被动技能"))
{
continue;
}
skillIndex++;
source.Skills[skillIndex] = GetSkill(skillsItem);
source.Skills[skillIndex].Index = skillIndex;
}
}
catch (System.Exception e)
{
TaskControl.Logger.LogError($"角色【{characterCard.Name}】卡牌配置解析失败:{e.Message}");
throw new System.Exception($"角色【{characterCard.Name}】卡牌配置解析失败:{e.Message}。请自行进行角色定义", e);
}
}
public static Skill GetSkill(SkillsItem skillsItem)
{
Skill skill = new()
{
Name = skillsItem.Name
};
var specificElementNum = 0;
foreach (var cost in skillsItem.Cost)
{
if (cost.NameEn == "unaligned_element")
{
skill.AnyElementCost = cost.Count;
}
else if (cost.NameEn == "energy")
{View on GitHub (pinned to a7cb36712d)
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.
Defensive patterns
Strategy: try-catch
Try / catch
try
{
CharacterCard.CopyCardProperty(source, characterCard);
}
catch (Exception e) when (e.Message.Contains("卡牌配置解析失败"))
{
TaskControl.Logger.LogWarning("角色卡牌配置解析失败,跳过该角色: {Msg}", e.Message);
// The message suggests '请自行进行角色定义' — use custom character definition
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- 识别骰子数量不正确,重试超时,停止自动打牌!
- 骰子数量与预期不符,重试次数过多,可能出现了未知错误!
- 未能获取到我方角色卡位置
- 等待对方行动超时,停止自动打牌!
- 未识别的主词条数值:{mainAffixValueLine}
AI-assisted analysis of babalae/better-genshin-impact@a7cb36712d (2026-08-13).
Data as JSON: /api/errors/4de9c8aed3ddc07d.
Report an issue: GitHub.