{"record":{"id":"08d8a9a6fafe9201","repo":"stride3d/stride","slug":"the-given-nameof-assetsidepart-id-does-not-correspond-to-any","errorCode":null,"errorMessage":"The given {nameof(assetSidePart.Id)} does not correspond to any existing part.","messagePattern":"The given (.+?) does not correspond to any existing part\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"sources/editor/Stride.Assets.Presentation/AssetEditors/PrefabEditor/Services/PrefabEditorController.cs","lineNumber":71,"sourceCode":"                        throw new InvalidOperationException($\"The given {nameof(parent.Id)} does not correspond to any existing part.\");\n\n                    GameSideNodeContainer.GetNode(parentEntity.Transform.Children).Add(gameSidePart.Transform);\n                }\n            });\n        }\n\n        /// <inheritdoc />\n        public override Task RemovePart([NotNull] EntityHierarchyElementViewModel parent, Entity assetSidePart)\n        {\n            EnsureAssetAccess();\n\n            return InvokeAsync(() =>\n            {\n                Logger.Debug($\"Removing entity {assetSidePart.Id} from game-side scene\");\n                var partId = new AbsoluteId(AssetId.Empty, assetSidePart.Id);\n                var part = (Entity)FindPart(partId);\n                if (part == null)\n                    throw new InvalidOperationException($\"The given {nameof(assetSidePart.Id)} does not correspond to any existing part.\");\n\n                if (parent is PrefabRootViewModel)\n                {\n                    Game.UnloadEntity(part);\n                }\n                else\n                {\n                    var parentEntity = (Entity)FindPart(parent.Id);\n                    if (parentEntity == null)\n                        throw new InvalidOperationException($\"The given {nameof(parent.Id)} does not correspond to any existing part.\");\n\n                    var i = parentEntity.Transform.Children.IndexOf(part.Transform);\n                    GameSideNodeContainer.GetNode(parentEntity.Transform.Children).Remove(part.Transform, new NodeIndex(i));\n                }\n            });\n        }\n\n        /// <summary>","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/editor/Stride.Assets.Presentation/AssetEditors/PrefabEditor/Services/PrefabEditorController.cs#L53-L89","documentation":"PrefabEditorController.RemovePart throws this InvalidOperationException when the asset-side part (wrapped as AbsoluteId(AssetId.Empty, part.Id)) cannot be found game-side via FindPart. It ensures RemovePart only operates on parts actually loaded in the editor game scene.","triggerScenarios":"Calling RemovePart with an assetSidePart whose Id was never loaded, was already removed, or whose id no longer matches the game-side AbsoluteId mapping.","commonSituations":"Double-delete after an undo/redo; removing an entity whose game-side counterpart failed to load; stale viewmodel references after prefab reload.","solutions":["Check that the part is currently loaded before calling RemovePart.","Refresh the hierarchy viewmodels so ids match the live game-side state.","Guard against duplicate removal calls (track removed ids).","Catch InvalidOperationException and treat the part as already gone."],"exampleFix":"// before\ncontroller.RemovePart(partViewModel, parent);\n// after\nvar partId = new AbsoluteId(AssetId.Empty, partViewModel.Id);\nif (controller.FindPart(partId) != null)\n    controller.RemovePart(partViewModel, parent);","handlingStrategy":"validation","validationCode":"var partId = new AbsoluteId(AssetId.Empty, assetSidePart.Id);\nif (controller.FindPart(partId) == null) return; // already gone","typeGuard":"bool PartLoaded(AssetViewModel p) => p?.Id != null && controller.FindPart(new AbsoluteId(AssetId.Empty, p.Id)) != null;","tryCatchPattern":"try { controller.RemovePart(part, parent); } catch (InvalidOperationException ex) when (ex.Message.Contains(\"does not correspond to any existing part\")) { logger.Debug($\"Part {part.Id} already removed\"); }","preventionTips":["Track removed part ids to avoid double deletes","Resynchronize viewmodels with the game-side hierarchy before mutations","Treat missing parts on removal as benign no-ops"],"tags":["stride-editor","prefab","entity-not-found","invalid-argument-value"],"backgroundTag":"record-not-found","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}