{"record":{"id":"e5a11ecbd7a88596","repo":"stride3d/stride","slug":"unable-to-find-the-base-asset-archetype-location-of-asset","errorCode":null,"errorMessage":"Unable to find the base [{Asset.Archetype.Location}] of asset [{Url}].","messagePattern":"Unable to find the base \\[(.+?)\\] of asset \\[(.+?)\\]\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"sources/editor/Stride.Core.Assets.Editor/ViewModel/AssetViewModel.cs","lineNumber":767,"sourceCode":"                {\n                    UndoRedoService.PushOperation(new AnonymousDirtyingOperation(Dirtiables, () => RestoreArchetype(clearedOverrides), ClearArchetype));\n                }\n\n                UndoRedoService.SetName(transaction, \"Clear archetype\");\n            }\n\n            // Force refreshing the property grid\n            Session.AssetViewProperties.RefreshSelectedPropertiesAsync().Forget();\n        }\n\n        private void RestoreArchetype([NotNull] List<AssetPropertyGraph.NodeOverride> clearedOverrides)\n        {\n            AssetViewModel baseViewModel = null;\n            if (Asset.Archetype != null)\n            {\n                baseViewModel = Session.GetAssetById(Asset.Archetype.Id);\n                if (baseViewModel == null)\n                    throw new InvalidOperationException($\"Unable to find the base [{Asset.Archetype.Location}] of asset [{Url}].\");\n            }\n\n            // Restore all overrides\n            PropertyGraph?.RestoreOverrides(clearedOverrides, baseViewModel?.PropertyGraph);\n\n            // Refresh the base to ensure everything is clean\n            PropertyGraph?.RefreshBase();\n\n            // Reconcile with base. This should not do anything!\n            PropertyGraph?.ReconcileWithBase();\n\n            // Force refreshing the property grid\n            Session.AssetViewProperties.RefreshSelectedPropertiesAsync().Forget();\n        }\n\n        IChildViewModel IChildViewModel.GetParent()\n        {\n            return Directory;","sourceCodeStart":749,"sourceCodeEnd":785,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/editor/Stride.Core.Assets.Editor/ViewModel/AssetViewModel.cs#L749-L785","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Restore or reload the base asset referenced by Asset.Archetype into the session before resetting overrides.","If the base is intentionally gone, break the inheritance: detach the archetype from the derived asset first, then reset.","Fix package references so the library package containing the base is loaded in the session."],"exampleFix":"// before\nvm.ResetOverrides(); // throws if base is missing\n// after\nif (vm.Asset.Archetype != null && vm.Session.GetAssetById(vm.Asset.Archetype.Id) == null)\n{\n    logger.Error($\"Base asset {vm.Asset.Archetype.Location} is missing; restore it before resetting overrides.\");\n    return;\n}\nvm.ResetOverrides();","handlingStrategy":"validation","validationCode":"if (vm.Asset.Archetype != null && vm.Session.GetAssetById(vm.Asset.Archetype.Id) == null)\n{\n    logger.Error($\"Base asset {vm.Asset.Archetype.Location} is not loaded; restore it before resetting overrides\");\n    return;\n}","typeGuard":"bool CanResetOverrides(AssetViewModel vm) => vm.Asset.Archetype == null || vm.Session.GetAssetById(vm.Asset.Archetype.Id) != null;","tryCatchPattern":"try { vm.ResetOverrides(); }\ncatch (InvalidOperationException ex) { logger.Error(ex, \"Archetype base missing from session; reload the package containing it\"); }","preventionTips":["Never delete a base/archetype asset while derived assets exist","Load all referenced shared-asset packages in the session","Validate archetype references after package moves or Id changes"],"tags":["assets","archetype","inheritance","missing-reference"],"backgroundTag":"resource-not-found","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}