EllanJiang/GameFramework · error · GameFrameworkException
Config name is invalid.
Error message
Config name is invalid.
What it means
ConfigManager.GetConfigData throws 'Config name is invalid.' when the configName argument is null or empty. This happens before any dictionary lookup: the manager refuses to search for an unnamed config. It is reached indirectly by public APIs like HasConfig and the configData property, as well as Get* accessors, whenever they are handed an empty name.
Solutions
- Validate the config name is a non-empty string before calling any ConfigManager API
- Trace the caller (HasConfig/configData) to find where the empty name originates
- Fix the upstream source (input field, split, deserialization) that produces the empty name
Example fix
// before
bool exists = config.HasConfig(nameFromInput);
// after
if (!string.IsNullOrEmpty(nameFromInput))
{
bool exists = config.HasConfig(nameFromInput);
} Defensive patterns
Strategy: validation
Validate before calling
if (string.IsNullOrEmpty(configName))
{
throw new ArgumentException("Config name must be non-empty", nameof(configName));
} Type guard
bool IsValidConfigName(string name) => !string.IsNullOrEmpty(name);
Try / catch
try { exists = config.HasConfig(name); }
catch (GameFrameworkException) { Log.Error("Empty config name passed to ConfigManager"); exists = false; } Prevention
- Validate names at the boundary (UI, deserialization) before they reach ConfigManager
- Check string.Split results for empty segments
- Fail fast on empty names in your own wrapper layer
- Avoid passing nullable string fields straight into config APIs
When it happens
Trigger: Calling HasConfig(null)/HasConfig(""), accessing the configData indexer/property with an empty name, or propagating an empty config name variable from a UI field, parsed table row, or failed string split.
Common situations: Config name read from an uninitialized or blank input field; splitting a 'key=value' string where the key part is empty; deserialized settings missing the name field; refactoring that renamed the constant feeding the call.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- Config helper is invalid.
- Config name ' ' is not exist.
- Update interval is invalid.
- Record interval is invalid.
- Entity group ' ' is not exist.
AI-assisted analysis of EllanJiang/GameFramework@d0c010b051 (2026-09-15).
Data as JSON: /api/errors/fe14b43ab0e6174a.
Report an issue: GitHub.
Appendix: source
Thrown at GameFramework/Config/ConfigManager.cs:475
return false;
}
return m_ConfigDatas.Remove(configName);
}
/// <summary>
/// 清空所有全局配置项。
/// </summary>
public void RemoveAllConfigs()
{
m_ConfigDatas.Clear();
}
private ConfigData? GetConfigData(string configName)
{
if (string.IsNullOrEmpty(configName))
{
throw new GameFrameworkException("Config name is invalid.");
}
ConfigData configData = default(ConfigData);
if (m_ConfigDatas.TryGetValue(configName, out configData))
{
return configData;
}
return null;
}
}
}
View on GitHub (pinned to d0c010b051)