EllanJiang/GameFramework · error · GameFrameworkException
Resource info ' ' is invalid.
Error message
Resource info '{0}' is invalid. What it means
During construction, ResourceGroupCollection resolves each resource name from every group against the supplied resourceInfos dictionary. It throws GameFrameworkException("Resource info '{0}' is invalid.") when a group contains a resource name absent from the dictionary, meaning the group's resource list and the resource-info table are out of sync.
Solutions
- Ensure both the groups and the resourceInfos dictionary come from the same ResourceManager state (same InitResources/UpdateResources generation).
- Re-run resource initialization so the dictionary matches the current resource list.
- Verify the package version matches the resource metadata version to avoid name drift.
Example fix
// before var staleInfos = LoadOldResourceInfos(); var col = new ResourceGroupCollection(groups, staleInfos); // after rm.InitResources(variant); // rebuild groups + infos together var col = new ResourceGroupCollection(groups, rm.CurrentResourceInfos);
Defensive patterns
Strategy: validation
Validate before calling
bool infosReady = groups.All(g =>
g.GetResourceNames(/* temp list */).All(n => resourceInfos.ContainsKey(ResourceName.Parse(n))));
if (!infosReady) throw new InvalidOperationException("Resource infos out of sync with groups"); Type guard
bool InfosMatchGroups(IEnumerable<string> names, Dictionary<ResourceName, ResourceInfo> infos) => names.All(n => infos.ContainsKey(ResourceName.Parse(n)));
Try / catch
try { var col = new ResourceGroupCollection(groups, infos); } catch (GameFrameworkException ex) { Log.Error($"Missing resource info: {ex.Message}"); } Prevention
- Build groups and resource infos from the same initialization pass
- Re-run InitResources after any package/version change
- Never pass stale or manually constructed dictionaries
When it happens
Trigger: The resourceInfos dictionary was built from a different (older/newer) resource list than the one the groups were populated from — e.g. constructing the collection with a dictionary from a previous InitResources or a partially updated state.
Common situations: Version mismatch between the packaged resource list and the local resource metadata; hot-update where groups were refreshed but m_ResourceInfos was not; passing a stale or hand-built dictionary to the constructor.
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
- Results is invalid.
- Resource groups is invalid.
- Resource infos is invalid.
- Results is invalid.
- Resource helper is invalid.
AI-assisted analysis of EllanJiang/GameFramework@d0c010b051 (2026-09-15).
Data as JSON: /api/errors/e75a352a3af8c10c.
Report an issue: GitHub.
Appendix: source
Thrown at GameFramework/Resource/ResourceManager.ResourceGroupCollection.cs:79
throw new GameFrameworkException(Utility.Text.Format("Resource group index '{0}' is invalid.", lastIndex));
}
m_ResourceGroups = resourceGroups;
m_ResourceInfos = resourceInfos;
m_ResourceNames = new HashSet<ResourceName>();
m_TotalLength = 0L;
m_TotalCompressedLength = 0L;
List<ResourceName> cachedResourceNames = new List<ResourceName>();
foreach (ResourceGroup resourceGroup in m_ResourceGroups)
{
resourceGroup.InternalGetResourceNames(cachedResourceNames);
foreach (ResourceName resourceName in cachedResourceNames)
{
ResourceInfo resourceInfo = null;
if (!m_ResourceInfos.TryGetValue(resourceName, out resourceInfo))
{
throw new GameFrameworkException(Utility.Text.Format("Resource info '{0}' is invalid.", resourceName.FullName));
}
if (m_ResourceNames.Add(resourceName))
{
m_TotalLength += resourceInfo.Length;
m_TotalCompressedLength += resourceInfo.CompressedLength;
}
}
}
}
/// <summary>
/// 获取资源组集合是否准备完毕。
/// </summary>
public bool Ready
{
get
{View on GitHub (pinned to d0c010b051)