egametang/ET · error
config factory not found: {configType.FullName}
Error message
config factory not found: {configType.FullName} What it means
Thrown by GetConfigFactory when no factory was ever registered for the requested configType. LoadOneConfig resolved the type and its ConfigProcessAttribute (Code), then asked for a factory, but ConfigFactoryGroupCollection has no entry keyed by that Type. This means the type is recognized as a code-config but no IConfigFactory targets it.
Source
Thrown at Packages/cn.etetet.loader/Scripts/Loader/Share/ConfigLoaderHelper.cs:167
{
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)
{
if (!configFactories.TryGetFactories(configType, out Dictionary<string, IConfigFactory> groupFactories))
{
throw new Exception($"config factory not found: {configType.FullName}");
}
List<string> activeGroups = GetActiveConfigGroups();
IConfigFactory match = null;
string matchedGroup = null;
foreach (string activeGroup in activeGroups)
{
if (!groupFactories.TryGetValue(activeGroup, out IConfigFactory factory))
{
continue;
}
if (match != null)
{
throw new Exception(
$"config factory group ambiguous: {configType.FullName}, matched groups: {matchedGroup}, {activeGroup}");
}
View on GitHub (pinned to 5cab01f7a8)
Solutions
- Ensure an IConfigFactory with ConfigType == the named category exists, is concrete, and is in a scanned assembly.
- If using codegen, regenerate factories for the new category.
- Confirm the factory's assembly is included in CodeTypes' type scan.
Example fix
// before — category declared but no factory
[ConfigProcess(ConfigType.Code)]
public class NewConfigCategory : ASingleton, IConfig { ... }
// (no NewConfigCategoryFactory anywhere)
// after — add the factory
public class NewConfigCategoryFactory : IConfigFactory
{
public Type ConfigType => typeof(NewConfigCategory);
public object Create() => new NewConfigCategory();
} Defensive patterns
Strategy: validation
Validate before calling
// Pre-flight: ensure every Code config type has a registered factory
var factoryTypes = allTypes.Where(t => typeof(IConfigFactory).IsAssignableFrom(t) && !t.IsAbstract && !t.IsInterface);
var factoryTargets = factoryTypes.Select(t => ((IConfigFactory)Activator.CreateInstance(t)).ConfigType).ToHashSet();
foreach (var ct in GetConfigTypes().Where(IsCodeConfig))
if (!factoryTargets.Contains(ct)) Log.Error($"no factory for code config {ct.FullName}"); Type guard
static bool HasFactory(Type configType, IEnumerable<Type> factoryTypes) =>
factoryTypes.Any(ft => ((IConfigFactory)Activator.CreateInstance(ft)).ConfigType == configType); Prevention
- Regenerate factories whenever a new config category is added.
- Ensure factory assemblies are included in CodeTypes' scan.
- Add a startup test that fails if any Code config lacks a factory.
When it happens
Trigger: A config category type carries ConfigProcessAttribute(Code) and reaches LoadOneConfig, but CreateConfigFactories never found/registered an IConfigFactory whose ConfigType equals it. Either the factory class is missing, was filtered out (abstract/interface), or its ConfigType points elsewhere.
Common situations: A new config category was added with its attribute but the matching factory wasn't generated; the factory exists in an assembly not scanned by CodeTypes; the factory is abstract and was skipped by the IsAbstract filter (line 95).
Related errors
- config factory target is null: {factory.GetType().FullName}
- duplicate config factory: {factory.ConfigType.FullName} grou
- create config factory failed: {factoryType.FullName}
- config group is empty: {factory.GetType().FullName}
- config create failed: {configType.FullName}
AI-assisted analysis of egametang/ET@5cab01f7a8 (2026-08-13).
Data as JSON: /api/errors/b50f91b8eed76764.
Report an issue: GitHub.