egametang/ET · error

config interface invalid: {configType.FullName}

Error message

config interface invalid: {configType.FullName}

What it means

Thrown by LoadOneConfig when the created object is ASingleton but does not also implement IConfig. The load pipeline needs both: ASingleton for World registration and IConfig so ApplyLoadedConfigs can call ResolveRef (ConfigLoaderHelper.cs:59). Missing IConfig means cross-config reference resolution would skip this category.

Source

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

            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)
        {
            if (!configFactories.TryGetFactories(configType, out Dictionary<string, IConfigFactory> groupFactories))
            {
                throw new Exception($"config factory not found: {configType.FullName}");
            }

View on GitHub (pinned to 5cab01f7a8)

Solutions

  1. Implement IConfig (including ResolveRef) on the named category.
  2. Ensure the codegen template emits both the ASingleton base and the IConfig interface.

Example fix

// before
public class MyConfigCategory : ASingleton { ... } // no IConfig

// after
public class MyConfigCategory : ASingleton, IConfig
{
    public void ResolveRef() { /* bind cross-refs */ }
}
Defensive patterns

Strategy: validation

Type guard

static bool ImplementsIConfig(Type t) => typeof(IConfig).IsAssignableFrom(t);

Prevention

When it happens

Trigger: A config category derives from ASingleton but does not implement IConfig. This check runs only after the ASingleton check (217) passes, so the object IS a singleton but lacks the config interface.

Common situations: A category was made a singleton but the IConfig interface (with ResolveRef) was not implemented; an older base class provided ASingleton but a newer split dropped IConfig.

Related errors


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