stride3d/stride · error · InvalidOperationException
The asset doesn't exist in the dependency manager anymore
Error message
The asset doesn't exist in the dependency manager anymore
What it means
After locating the asset item, AddAssetToComputePackage computes outgoing recursive dependencies via session.DependencyManager.ComputeDependencies. A null result means the dependency manager no longer tracks this asset's id, so compilation data cannot be built; an InvalidOperationException is thrown.
Solutions
- Ensure the session is fully loaded before building compile packages
- Rebuild/refresh the dependency manager (reload session) and retry
- Verify the asset still exists and its package is loaded
Example fix
// before
session.AddAssetToCompilePackage(item, cloned); // may throw after Clear()
// after
if (session.DependencyManager.FindDependencies(item.Id) != null)
session.AddAssetToCompilePackage(item, cloned); Defensive patterns
Strategy: validation
Validate before calling
var deps = session.DependencyManager.ComputeDependencies(item.Id, AssetDependencySearchOptions.Out);
if (deps == null) throw new InvalidOperationException("Dependency manager has no node for this asset; reload the session"); Try / catch
try { session.AddAssetToCompilePackage(item, cloned); }
catch (InvalidOperationException ex) when (ex.Message.Contains("dependency manager"))
{ logger.Error(ex, "Dependency graph stale; reload session"); } Prevention
- Only build compile packages on fully loaded sessions
- Refresh the dependency graph after structural session changes
- Avoid calling right after session.Clear()
When it happens
Trigger: Calling AddAssetToCompilePackage when the asset id is absent from session.DependencyManager — e.g. the dependency manager was rebuilt/cleared, the asset was removed, or the session wasn't fully loaded.
Common situations: Calling during a partially loaded session, after session.Clear(), or after the asset's package was unloaded so dependency graph nodes were dropped.
Understand the failure class
Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.
Related errors
- No Collection item identifier associated to the given…
- Cannot find the specified AssetItem instance in the session
- Unable to find the base
- Unable to find the graph corresponding to the base part
- The base is unset for the current node.
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/7ab8f9135e2c4546.
Report an issue: GitHub.
Appendix: source
Thrown at sources/assets/Stride.Core.Assets/PackageSession.Extensions.cs:41
_ = new PackageSession(assetPackageCloned);
AddAssetToCompilePackage(session, originalAssetItem, assetPackageCloned);
return assetPackageCloned;
}
public static void AddAssetToCompilePackage(this PackageSession session, AssetItem originalAssetItem, Package assetPackageCloned)
{
ArgumentNullException.ThrowIfNull(originalAssetItem);
// Find the asset from the session
var assetItem = originalAssetItem.Package?.FindAsset(originalAssetItem.Id)
?? throw new ArgumentException("Cannot find the specified AssetItem instance in the session");
// Calculate dependencies
// Search only for references
var dependencies = session.DependencyManager.ComputeDependencies(assetItem.Id, AssetDependencySearchOptions.Out | AssetDependencySearchOptions.Recursive, ContentLinkType.Reference)
?? throw new InvalidOperationException("The asset doesn't exist in the dependency manager anymore");
var assetItemRootCloned = dependencies.Item.Clone();
// Store the fullpath to the sourcefolder, this avoid us to clone hierarchy of packages
assetItemRootCloned.SourceFolder = assetItem.FullPath.GetParent();
if (assetPackageCloned.Assets.Find(assetItemRootCloned.Id) == null)
assetPackageCloned.Assets.Add(assetItemRootCloned);
// For each asset item dependency, clone it in the new package
foreach (var assetLink in dependencies.LinksOut)
{
// Only add assets not already added (in case of circular dependencies)
if (assetPackageCloned.Assets.Find(assetLink.Item.Id) == null)
{
// create a copy of the asset item and add it to the appropriate compile package
var itemCloned = assetLink.Item.Clone();
// Store the fullpath to the sourcefolder, this avoid us to clone hierarchy of packagesView on GitHub (pinned to 96fad776d2)