egametang/ET · error

config factory group ambiguous: {configType.FullName}, match

Error message

config factory group ambiguous: {configType.FullName}, matched groups: {matchedGroup}, {activeGroup}

What it means

Thrown by GetConfigFactory when more than one active config group has a factory registered for the same config type. GetActiveConfigGroups() returns ["Config"] plus the StartConfig from Options.Instance; if both groups define a factory for the same configType, the loader cannot decide which one to use and aborts. The error message names the two colliding groups so you can see exactly which are conflicting.

Source

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

        {
            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}");
                }

                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()
        {

View on GitHub (pinned to 5cab01f7a8)

Solutions

  1. Read the two group names in the error message; ensure each config type has a factory in at most one active group. Move or remove the duplicate factory registration from one of the two groups.
  2. If both groups legitimately need the same config type, restructure so one group inherits/overrides the other via a different ConfigGroup attribute name, and only one is active.
  3. Verify Options.Instance.StartConfig is set to the intended group and that group does not redundantly register the same config types as the base Config group.

Example fix

// before: both Config and Release groups register a factory for AppConfig
// move AppConfig factory out of the Release group, or:
[Config( typeof(AppConfig) )]
[ConfigGroup("Config")]
public class AppConfigConfig : ConfigCategory<AppConfig> { }

// remove the duplicate in the Release group entirely
Defensive patterns

Strategy: validation

Validate before calling

// Before loading configs, verify no config type has factories in multiple active groups
List<string> activeGroups = GetActiveConfigGroups();
foreach (var configType in allConfigTypes)
{
    if (configFactories.TryGetFactories(configType, out var groups))
    {
        int matches = activeGroups.Count(g => groups.ContainsKey(g));
        if (matches > 1)
            Log.Error($"Config type {configType.FullName} matches {matches} active groups — will be ambiguous at load time");
    }
}

Prevention

When it happens

Trigger: Two or more [ConfigGroup] attributes across different assemblies register factories for the same config type, AND GetActiveConfigGroups() resolves to multiple of those groups at runtime. Concretely: Options.Instance.StartConfig is set to a group name that also has a factory for the same config type that the default "Config" group already covers.

Common situations: Running with a StartConfig (e.g. a locale, channel, or environment variant) whose config factories overlap with the base "Config" group. Copying config factory registration code into a new group without removing it from the old one. Merging two config groups during a refactor and forgetting to de-duplicate.

Related errors


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