EllanJiang/GameFramework · error · GameFrameworkException
Resource group names is invalid.
Error message
Resource group names is invalid.
What it means
ResourceManager.GetResourceGroupCollection(params string[] resourceGroupNames) throws this when the names array is null or has zero entries. A collection requires at least one named resource group to aggregate.
Solutions
- Pass at least one valid resource group name
- Check array length > 0 before calling
- Fix the configuration/parsing step that produced an empty name list
Example fix
// before
string[] names = LoadNames(); // empty
var collection = manager.GetResourceGroupCollection(names);
// after
if (names != null && names.Length > 0)
var collection = manager.GetResourceGroupCollection(names); Defensive patterns
Strategy: validation
Validate before calling
if (names == null || names.Length == 0) throw new ArgumentException("At least one resource group name is required", nameof(names)); Type guard
bool IsValidGroupNames(string[] names) => names != null && names.Length > 0 && names.All(n => !string.IsNullOrEmpty(n));
Try / catch
try { var col = manager.GetResourceGroupCollection(names); }
catch (GameFrameworkException ex) when (ex.Message == "Resource group names is invalid.") { log.Error("No resource group names supplied"); } Prevention
- Check collections are non-empty before spreading into params
- Fail fast on empty config lists at startup
- Use a dedicated wrapper type for group-name lists that enforces non-emptiness
When it happens
Trigger: Calling GetResourceGroupCollection() with no arguments, with a null string[], or with an empty array variable.
Common situations: Building the name list from config that yielded no entries, then spreading it via params; callers passing an array that a parse step returned empty.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Resource group name is invalid.
- Resource group ' ' is not exist.
- Results is invalid.
- Apply resources complete callback is invalid.
- Asset is invalid.
AI-assisted analysis of EllanJiang/GameFramework@d0c010b051 (2026-09-15).
Data as JSON: /api/errors/b04016147216eb20.
Report an issue: GitHub.
Appendix: source
Thrown at GameFramework/Resource/ResourceManager.cs:2182
}
results.Clear();
foreach (KeyValuePair<string, ResourceGroup> resourceGroup in m_ResourceGroups)
{
results.Add(resourceGroup.Value);
}
}
/// <summary>
/// 获取资源组集合。
/// </summary>
/// <param name="resourceGroupNames">要获取的资源组名称的集合。</param>
/// <returns>要获取的资源组集合。</returns>
public IResourceGroupCollection GetResourceGroupCollection(params string[] resourceGroupNames)
{
if (resourceGroupNames == null || resourceGroupNames.Length < 1)
{
throw new GameFrameworkException("Resource group names is invalid.");
}
ResourceGroup[] resourceGroups = new ResourceGroup[resourceGroupNames.Length];
for (int i = 0; i < resourceGroupNames.Length; i++)
{
if (string.IsNullOrEmpty(resourceGroupNames[i]))
{
throw new GameFrameworkException("Resource group name is invalid.");
}
resourceGroups[i] = (ResourceGroup)GetResourceGroup(resourceGroupNames[i]);
if (resourceGroups[i] == null)
{
throw new GameFrameworkException(Utility.Text.Format("Resource group '{0}' is not exist.", resourceGroupNames[i]));
}
}
return new ResourceGroupCollection(resourceGroups, m_ResourceInfos);View on GitHub (pinned to d0c010b051)