egametang/ET · error
config singleton invalid: {configType.FullName}
Error message
config singleton invalid: {configType.FullName} What it means
Thrown by LoadOneConfig when the created category object is not an ASingleton. The ET framework registers configs as singletons via World.ReplaceSingleton, so every code-config category must inherit ASingleton; if it only implements IConfig (or neither), it cannot be registered and the load aborts.
Source
Thrown at Packages/cn.etetet.loader/Scripts/Loader/Share/ConfigLoaderHelper.cs:145
{
throw new Exception($"unsupported config type: {configProcessAttribute.ConfigType} {configType.FullName}");
}
IConfigFactory factory = GetConfigFactory(configType, configFactories);
object category = factory.Create();
if (category == null)
{
throw new Exception($"config create failed: {configType.FullName}");
}
if (category.GetType() != configType)
{
throw new Exception($"config type mismatch: expect={configType.FullName} actual={category.GetType().FullName}");
}
if (category is not ASingleton singleton)
{
throw new Exception($"config singleton invalid: {configType.FullName}");
}
if (category is not IConfig iConfig)
{
throw new Exception($"config interface invalid: {configType.FullName}");
}
loadedConfigs.Add(configType, iConfig);
return singleton;
}
private static string GetConfigGroup(MemberInfo factoryType)
{
ConfigGroupAttribute configGroupAttribute = factoryType.GetCustomAttribute<ConfigGroupAttribute>();
return string.IsNullOrWhiteSpace(configGroupAttribute?.Name) ? ConfigGroupNames.Config : configGroupAttribute.Name;
}
private static IConfigFactory GetConfigFactory(Type configType, ConfigFactoryGroupCollection configFactories)View on GitHub (pinned to 5cab01f7a8)
Solutions
- Make the named config category derive from ASingleton (and still implement IConfig).
- Update the codegen template so all config categories inherit ASingleton.
Example fix
// before
public class MyConfigCategory : IConfig { ... }
// after
public class MyConfigCategory : ASingleton, IConfig { ... } Defensive patterns
Strategy: validation
Type guard
static bool IsCodeConfigCategory(Type t) =>
typeof(ASingleton).IsAssignableFrom(t) && typeof(IConfig).IsAssignableFrom(t); Prevention
- All code-config categories must derive from ASingleton.
- Enforce via a codegen template and a build-time reflection check.
- Document the required base+interface contract for config categories.
When it happens
Trigger: A config category class implements IConfig but does not derive from ASingleton. LoadOneConfig's 'is not ASingleton' pattern (line 143) catches this after the type-equality check passes.
Common situations: A hand-written config category omitted the ASingleton base class; a codegen template generated a plain class; a refactor moved the category off the singleton hierarchy.
Related errors
- config factory target is null: {factory.GetType().FullName}
- config type mismatch: expect={configType.FullName} actual={c
- not found scene type: {type} {sceneName}
- config group is empty: {factory.GetType().FullName}
- duplicate config factory: {factory.ConfigType.FullName} grou
AI-assisted analysis of egametang/ET@5cab01f7a8 (2026-08-13).
Data as JSON: /api/errors/0b1bcb2655343971.
Report an issue: GitHub.