EllanJiang/GameFramework · error · GameFrameworkException

Config name ' ' is not exist.

Error message

Config name '{0}' is not exist.

What it means

ConfigManager.GetBool looks up a config by exact name; if no config data with that name exists (GetConfigData returns null), it throws GameFrameworkException with the offending name. It signals a lookup of a config string that was never loaded or registered.

Solutions

  1. Verify the config name exists in the loaded config table (check spelling and case)
  2. Ensure the config file/table is loaded (LoadConfig / LoadDictionary) before calling GetBool
  3. If optional, use configData.HasValue via GetConfigData pattern or your own Contains check before reading

Example fix

// before
bool soundOn = m_ConfigManager.GetBool("Sound.Enable"); // may not exist
// after
if (m_ConfigManager.HasConfig("Sound.Enable"))
{
    bool soundOn = m_ConfigManager.GetBool("Sound.Enable");
}
else
{
    bool soundOn = true; // default
}
Defensive patterns

Strategy: fallback

Validate before calling

if (!configManager.HasConfig(name)) { /* use default */ }
bool value = configManager.GetBool(name);

Try / catch

try { return configManager.GetBool(name); }
catch (GameFrameworkException) { return defaultValue; }

Prevention

When it happens

Trigger: Calling GetBool("SomeName") where SomeName was never added via AddConfig/LoadConfig, or the config asset/table failed to load, or the name has a typo/different casing.

Common situations: Renaming a config key in the table but not in code; config file not loaded before first access (initialization order); locale/variant config tables missing an entry.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of EllanJiang/GameFramework@d0c010b051 (2026-09-15). Data as JSON: /api/errors/a5ec9aa971968395. Report an issue: GitHub.

Appendix: source

Thrown at GameFramework/Config/ConfigManager.cs:307

        /// </summary>
        /// <param name="configName">要检查全局配置项的名称。</param>
        /// <returns>指定的全局配置项是否存在。</returns>
        public bool HasConfig(string configName)
        {
            return GetConfigData(configName).HasValue;
        }

        /// <summary>
        /// 从指定全局配置项中读取布尔值。
        /// </summary>
        /// <param name="configName">要获取全局配置项的名称。</param>
        /// <returns>读取的布尔值。</returns>
        public bool GetBool(string configName)
        {
            ConfigData? configData = GetConfigData(configName);
            if (!configData.HasValue)
            {
                throw new GameFrameworkException(Utility.Text.Format("Config name '{0}' is not exist.", configName));
            }

            return configData.Value.BoolValue;
        }

        /// <summary>
        /// 从指定全局配置项中读取布尔值。
        /// </summary>
        /// <param name="configName">要获取全局配置项的名称。</param>
        /// <param name="defaultValue">当指定的全局配置项不存在时,返回此默认值。</param>
        /// <returns>读取的布尔值。</returns>
        public bool GetBool(string configName, bool defaultValue)
        {
            ConfigData? configData = GetConfigData(configName);
            return configData.HasValue ? configData.Value.BoolValue : defaultValue;
        }

        /// <summary>

View on GitHub (pinned to d0c010b051)