babalae/better-genshin-impact · error · ArgumentException
AutoSkip的配置参数需要为AutoSkipConfig类型
Error message
AutoSkip的配置参数需要为AutoSkipConfig类型
What it means
Thrown by the RealtimeTimer constructor when Name equals "AutoSkip" but the provided config object is not of type AutoSkipConfig. Unlike AutoPick (which auto-converts via ScriptObjectConverter), AutoSkip requires the caller to pass an already-typed AutoSkipConfig instance — no conversion is attempted.
Source
Thrown at BetterGenshinImpact/Core/Script/Dependence/Model/RealTimeTimer.cs:53
Name = name;
}
public RealtimeTimer(string name, dynamic config)
{
Name = name;
if (Name == "AutoPick")
{
Config = ScriptObjectConverter.ConvertTo<AutoPickExternalConfig>(config);
}
else if (Name == "AutoSkip")
{
if (config is AutoSkipConfig)
{
Config = config;
}
else
{
throw new ArgumentException("AutoSkip的配置参数需要为AutoSkipConfig类型");
}
}
}
}
View on GitHub (pinned to a7cb36712d)
Solutions
- Pre-convert the config: pass ScriptObjectConverter.ConvertTo<AutoSkipConfig>(config) into the constructor.
- Ensure your JSON deserialization uses typed settings that map the AutoSkip config field to AutoSkipConfig.
- If building programmatically, construct new AutoSkipConfig() and populate its properties directly.
Example fix
// before
var timer = new RealtimeTimer("AutoSkip", jObject);
// after
var cfg = ScriptObjectConverter.ConvertTo<AutoSkipConfig>(jObject);
var timer = new RealtimeTimer("AutoSkip", cfg); Defensive patterns
Strategy: type-guard
Validate before calling
if (name == "AutoSkip")
{
var typedConfig = config is AutoSkipConfig existing
? existing
: ScriptObjectConverter.ConvertTo<AutoSkipConfig>(config);
var timer = new RealtimeTimer(name, typedConfig);
} Type guard
static bool IsValidAutoSkipConfig(object config) => config is AutoSkipConfig;
Try / catch
try
{
var timer = new RealtimeTimer("AutoSkip", config);
}
catch (ArgumentException ex) when (ex.Message.Contains("AutoSkip"))
{
// Convert and retry
var converted = ScriptObjectConverter.ConvertTo<AutoSkipConfig>(config);
var timer = new RealtimeTimer("AutoSkip", converted);
} Prevention
- Always convert dynamic/JObject configs to their target type before passing to RealtimeTimer for AutoSkip.
- Use typed deserialization for timer configurations instead of raw JObject.
When it happens
Trigger: Constructing new RealtimeTimer("AutoSkip", config) where config is a JObject, ExpandoObject, anonymous type, or any type other than AutoSkipConfig. The check is a strict 'is AutoSkipConfig' type test.
Common situations: Deserializing a timer configuration from JSON where the config field is parsed as a generic object/JObject rather than a typed AutoSkipConfig. Migrating from a dynamic config model to typed configs without updating the serialization path.
Related errors
- {paramName} 中的每个元素都必须是 {typeof(T).Name}
- ReadImageMatWithResizeSync: 不支持的插值算法 {interpolation}
- 键盘编码必须是VirtualKeyCodes枚举中的值,当前传入的 {key} 不合法
- 仓库URL不能为空
- 角色名参数必须是字符串集合或 JS Array。
AI-assisted analysis of babalae/better-genshin-impact@a7cb36712d (2026-08-13).
Data as JSON: /api/errors/c6ef76b951684f2e.
Report an issue: GitHub.