babalae/better-genshin-impact · error · Exception
角色【{standardName}】暂无默认卡牌定义配置,请自行进行角色定义
Error message
角色【{standardName}】暂无默认卡牌定义配置,请自行进行角色定义 What it means
Thrown by ScriptParser.ParseCharacter when a character is defined without an explicit skill block (no '|' separator / no '{}' block) AND the character name cannot be found in DefaultTcgConfig.CharacterCardMap or resolved via DefaultAutoFightConfig.AvatarAliasToStandardName. The parser first tries an exact match in the TCG card map, then falls back to the fight-config alias resolver. If neither yields a standard name present in the TCG config, the character has no known card data (skills, talents, element) and cannot be automated.
Source
Thrown at BetterGenshinImpact/GameTask/AutoGeniusInvokation/ScriptParser.cs:178
character.Skills = [.. skills];
}
else
{
// 没有配置直接使用默认配置
character.Name = parts[1];
var standardName = DefaultTcgConfig.CharacterCardMap.Keys.FirstOrDefault(x => x.Equals(character.Name));
if (string.IsNullOrEmpty(standardName))
{
standardName = DefaultAutoFightConfig.AvatarAliasToStandardName(character.Name);
}
if (DefaultTcgConfig.CharacterCardMap.TryGetValue(standardName, out var characterCard))
{
CharacterCard.CopyCardProperty(character, characterCard);
}
else
{
throw new System.Exception($"角色【{standardName}】暂无默认卡牌定义配置,请自行进行角色定义");
}
}
return character;
}
/// <summary>
/// 技能3消耗=1雷骰子+2任意
/// 技能2消耗=3雷骰子
/// 技能1消耗=4雷骰子
/// </summary>
/// <param name="oneSkillStr"></param>
/// <returns></returns>
public static Skill ParseSkill(string oneSkillStr)
{
var skill = new Skill();
var parts = oneSkillStr.Split('=');
skill.Index = short.Parse(RegexHelper.ExcludeNumberRegex().Replace(parts[0], ""));View on GitHub (pinned to a7cb36712d)
Solutions
- Define the character with an explicit skill block: '角色1=角色名|元素{技能1消耗=3雷骰子,技能2消耗=...}'.
- Check DefaultTcgConfig.CharacterCardMap keys for the exact supported character name and use that spelling.
- If the character is genuinely unsupported, wait for a tool update that adds the card data, or contribute a config entry.
- Verify the character name has no trailing whitespace or full-width characters.
Example fix
// before — relies on default config that does not contain the character
角色1=流浪者
// after — explicit skill definition
角色1=流浪者|风{技能1消耗=3风骰子,技能2消耗=3风骰子,技能3消耗=1风骰子+2任意} Defensive patterns
Strategy: validation
Validate before calling
// Before parsing, check if the character name exists in default config
if (!DefaultTcgConfig.CharacterCardMap.ContainsKey(characterName)
&& string.IsNullOrEmpty(DefaultAutoFightConfig.AvatarAliasToStandardName(characterName)))
{
Logger.LogWarning("角色 {Name} 未在默认配置中,请手动定义技能", characterName);
} Type guard
public static bool IsCharacterSupported(string name)
{
var standardName = DefaultTcgConfig.CharacterCardMap.Keys
.FirstOrDefault(x => x.Equals(name));
if (string.IsNullOrEmpty(standardName))
{
standardName = DefaultAutoFightConfig.AvatarAliasToStandardName(name);
}
return !string.IsNullOrEmpty(standardName)
&& DefaultTcgConfig.CharacterCardMap.ContainsKey(standardName);
} Try / catch
catch (System.Exception ex) when (ex.Message.Contains("暂无默认卡牌定义配置"))
{
MyLogger.LogError($"角色不支持自动配置,请手动编写技能定义。错误: {ex.Message}");
ThemedMessageBox.Error($"请在脚本中为该角色手动定义技能。{ex.Message}", "角色配置缺失");
return default!;
} Prevention
- For unsupported characters, always provide an explicit skill block in the script: '角色N=名字|元素{技能...}'.
- Check DefaultTcgConfig.CharacterCardMap for the list of supported character names.
- Use exact character name spelling from the config.
When it happens
Trigger: A strategy script line like '角色1=新角色名' (without a {...} skill definition) where '新角色名' is not in DefaultTcgConfig.CharacterCardMap and has no alias in DefaultAutoFightConfig. This happens when a new Genshin character has been added to the game but not yet added to the bundled default TCG configuration.
Common situations: Game updated with a new TCG character card that the tool does not yet support; user typed a character name with a typo or non-standard alias; user mixed character names from different localizations (e.g. English name in a Chinese config).
Related errors
- 未知的定义字段:{stage}
- AutoSkip的配置参数需要为AutoSkipConfig类型
- 从 library 字段读取路径 '{path}' 失败: {ex.Message}
- 解析配置组JSON配置失败
- manifest.json: name is required.
AI-assisted analysis of babalae/better-genshin-impact@a7cb36712d (2026-08-13).
Data as JSON: /api/errors/c76892640787ce75.
Report an issue: GitHub.