stride3d/stride · error · InvalidOperationException
Could not find asset
Error message
Could not find asset {0} for bundle {1} What it means
UpdateFromMember with NodeIndex.Empty means the node's root value itself is being replaced, which is forbidden for ObjectNode: an object node's value is fixed at construction and only its members/items may change. The method throws InvalidOperationException to enforce this invariant.
Solutions
- Update individual members via their MemberNode.SetValue instead of replacing the root object.
- Only call UpdateFromMember with a non-empty NodeIndex targeting a collection item.
- If the whole object must be replaced, construct a new ObjectNode (or a new model) rather than mutating this one.
Example fix
// before objectNode.UpdateFromMember(newObject, NodeIndex.Empty); // after objectNode.GetMember(nameof(MyType.Name)).Update(newObject.Name);
Defensive patterns
Strategy: validation
Validate before calling
if (index == NodeIndex.Empty)
throw new InvalidOperationException("Use MemberNode.SetValue to change members; ObjectNode root value is fixed"); Type guard
bool CanUpdateRoot(GraphNode node) => node is not ObjectNode || node is not IObjectNode { }; // ObjectNode never allows empty-index update Try / catch
try { node.UpdateFromMember(newValue, index); }
catch (InvalidOperationException ex) when (ex.Message.Contains("cannot be modified")) { /* rebuild the node or update members individually */ } Prevention
- Treat ObjectNode root values as immutable after construction
- Update members via MemberNode APIs
- Only call UpdateFromMember with a real item index
When it happens
Trigger: Calling UpdateFromMember(newValue, NodeIndex.Empty) on an ObjectNode — i.e. internal/derived code attempting to reassign the entire object instance held by the node instead of updating a member or collection item.
Common situations: Custom node framework extensions or undo/redo systems that try to swap the underlying object wholesale; refactoring MemberNode-style update code onto ObjectNode without adjusting the index.
Understand the failure class
Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.
Related errors
- Expect name1=value1;name2=value2 format.
- Cannot modify a YamlAssetMetadata after it has been…
- (Name= ) already has a content.
- The given (Name= ) is not the current content of (Name= ).
- Two bundles with name
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/dbb392d1cf96d5f9.
Report an issue: GitHub.
Appendix: source
Thrown at sources/assets/Stride.AssetCompiler/BundlePacker.cs:414
references.Add(chunkReference.Location);
}
}
}
}
}
return references;
}
private void CollectReferences(DatabaseFileProvider databaseFileProvider, Bundle bundle, HashSet<string> assets, string assetUrl)
{
// Already included?
if (!assets.Add(assetUrl))
return;
ObjectId objectId;
if (!databaseFileProvider.ContentIndexMap.TryGetValue(assetUrl, out objectId))
throw new InvalidOperationException(string.Format("Could not find asset {0} for bundle {1}", assetUrl, bundle.Name));
// Include references
foreach (var reference in GetChunkReferences(databaseFileProvider, ref objectId))
{
CollectReferences(databaseFileProvider, bundle, assets, reference);
}
}
private void CollectBundle(DatabaseFileProvider databaseFileProvider, ResolvedBundle resolvedBundle, string assetUrl)
{
// Check if index map contains it already (that also means object id has been stored as well)
if (resolvedBundle.DependencyIndexMap.ContainsKey(assetUrl) || resolvedBundle.IndexMap.ContainsKey(assetUrl))
return;
ObjectId objectId;
if (!databaseFileProvider.ContentIndexMap.TryGetValue(assetUrl, out objectId))
throw new InvalidOperationException(string.Format("Could not find asset {0} for bundle {1}", assetUrl, resolvedBundle.Name));
View on GitHub (pinned to 96fad776d2)