stride3d/stride · error · InvalidOperationException

Unable to find the base

Error message

Unable to find the base [{Asset.Archetype.Location}] of asset [{Url}].

What it means

When resetting an asset's overrides, the editor resolves the asset's archetype (base) by Id through Session.GetAssetById. If Asset.Archetype is set but no view model for that base asset exists in the session, the inheritance chain is broken and an InvalidOperationException is thrown rather than silently losing the base.

Solutions

  1. Restore or reload the base asset referenced by Asset.Archetype into the session before resetting overrides.
  2. If the base is intentionally gone, break the inheritance: detach the archetype from the derived asset first, then reset.
  3. Fix package references so the library package containing the base is loaded in the session.

Example fix

// before
vm.ResetOverrides(); // throws if base is missing
// after
if (vm.Asset.Archetype != null && vm.Session.GetAssetById(vm.Asset.Archetype.Id) == null)
{
    logger.Error($"Base asset {vm.Asset.Archetype.Location} is missing; restore it before resetting overrides.");
    return;
}
vm.ResetOverrides();
Defensive patterns

Strategy: validation

Validate before calling

if (vm.Asset.Archetype != null && vm.Session.GetAssetById(vm.Asset.Archetype.Id) == null)
{
    logger.Error($"Base asset {vm.Asset.Archetype.Location} is not loaded; restore it before resetting overrides");
    return;
}

Type guard

bool CanResetOverrides(AssetViewModel vm) => vm.Asset.Archetype == null || vm.Session.GetAssetById(vm.Asset.Archetype.Id) != null;

Try / catch

try { vm.ResetOverrides(); }
catch (InvalidOperationException ex) { logger.Error(ex, "Archetype base missing from session; reload the package containing it"); }

Prevention

When it happens

Trigger: Resetting/clearing overrides on a derived asset whose base asset was deleted, is in a closed/unloaded package, or belongs to a session that was not loaded into the editor.

Common situations: Deleting a base/prefab asset while derived instances remain; shared-asset libraries referenced but not opened; session refreshes dropping asset registrations; corrupted Archetype references after Id changes.

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


AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14). Data as JSON: /api/errors/e5a11ecbd7a88596. Report an issue: GitHub.

Appendix: source

Thrown at sources/editor/Stride.Core.Assets.Editor/ViewModel/AssetViewModel.cs:767

                {
                    UndoRedoService.PushOperation(new AnonymousDirtyingOperation(Dirtiables, () => RestoreArchetype(clearedOverrides), ClearArchetype));
                }

                UndoRedoService.SetName(transaction, "Clear archetype");
            }

            // Force refreshing the property grid
            Session.AssetViewProperties.RefreshSelectedPropertiesAsync().Forget();
        }

        private void RestoreArchetype([NotNull] List<AssetPropertyGraph.NodeOverride> clearedOverrides)
        {
            AssetViewModel baseViewModel = null;
            if (Asset.Archetype != null)
            {
                baseViewModel = Session.GetAssetById(Asset.Archetype.Id);
                if (baseViewModel == null)
                    throw new InvalidOperationException($"Unable to find the base [{Asset.Archetype.Location}] of asset [{Url}].");
            }

            // Restore all overrides
            PropertyGraph?.RestoreOverrides(clearedOverrides, baseViewModel?.PropertyGraph);

            // Refresh the base to ensure everything is clean
            PropertyGraph?.RefreshBase();

            // Reconcile with base. This should not do anything!
            PropertyGraph?.ReconcileWithBase();

            // Force refreshing the property grid
            Session.AssetViewProperties.RefreshSelectedPropertiesAsync().Forget();
        }

        IChildViewModel IChildViewModel.GetParent()
        {
            return Directory;

View on GitHub (pinned to 96fad776d2)