egametang/ET · error

config factory group not found

Error message

config factory group not found: {configType.FullName}, active groups: {string.Join(", ", activeGroups)}, available groups: {string.Join(", ", groupFactories.Keys)}

What it means

Thrown by GetConfigFactory when no active config group contains a factory for the requested config type. The active groups are ["Config"] plus Options.Instance.StartConfig if set. If none of those groups register a factory for configType, the loader fails with the list of active groups and the groups that ARE available, so you can see what's missing.

Solutions

  1. Check the 'available groups' in the error message; if the needed group exists but isn't active, set Options.Instance.StartConfig to that group name.
  2. If the group is missing entirely, ensure the assembly containing the [Config]/[ConfigGroup] factory registration is referenced and loaded by CodeTypes scanning.
  3. If the config type itself is missing, add the config factory class with the correct [ConfigGroup] attribute pointing to an active group.

Example fix

// before: Options.StartConfig = "Test"; but factory only registered under "Release"
// after: either set the correct StartConfig
Options.Instance.StartConfig = "Release";
// or register the factory under the active group
[ConfigGroup("Config")]
public class MyConfigFactory : ConfigCategory<MyConfig> { }
Defensive patterns

Strategy: validation

Validate before calling

// Before loading, verify every required config type has a factory in at least one active group
List<string> activeGroups = GetActiveConfigGroups();
foreach (var configType in requiredConfigTypes)
{
    if (!configFactories.TryGetFactories(configType, out var groups) ||
        !activeGroups.Any(g => groups.ContainsKey(g)))
    {
        Log.Error($"Config type {configType.FullName} has no factory in active groups: {string.Join(", ", activeGroups)}");
    }
}

Prevention

When it happens

Trigger: A config type exists in a group that is not currently active (e.g. it is registered under a group name that differs from both "Config" and Options.Instance.StartConfig). Or the config factory registration assembly was not loaded/scanned, so groupFactories.Keys does not include the expected group.

Common situations: StartConfig is set to a group name that has no factories for some config types the app needs. Config factory assemblies were excluded from the build or not added to the loader scan list. A config type was renamed but its ConfigGroup attribute was not updated.

Related errors


AI-assisted analysis of egametang/ET@5cab01f7a8 (2026-08-13). Data as JSON: /api/errors/e2465867506c4fc4. Report an issue: GitHub.

Appendix: source

Thrown at Packages/cn.etetet.loader/Scripts/Loader/Share/ConfigLoaderHelper.cs:195

                    continue;
                }

                if (match != null)
                {
                    throw new Exception(
                        $"config factory group ambiguous: {configType.FullName}, matched groups: {matchedGroup}, {activeGroup}");
                }

                match = factory;
                matchedGroup = activeGroup;
            }

            if (match != null)
            {
                return match;
            }

            throw new Exception(
                $"config factory group not found: {configType.FullName}, active groups: {string.Join(", ", activeGroups)}, available groups: {string.Join(", ", groupFactories.Keys)}");
        }

        private static List<string> GetActiveConfigGroups()
        {
            List<string> groups = new() { ConfigGroupNames.Config };
            string startConfig = Options.Instance?.StartConfig;
            if (!string.IsNullOrWhiteSpace(startConfig) && !string.Equals(startConfig, ConfigGroupNames.Config, StringComparison.Ordinal))
            {
                groups.Add(startConfig);
            }

            return groups;
        }
    }
}

View on GitHub (pinned to 5cab01f7a8)