{"record":{"id":"d28ec23894341838","repo":"stride3d/stride","slug":"the-given-nameof-assetsidepart-id-does-not-correspond-to-any-d28ec2","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/SceneEditor/Services/SceneEditorController.cs","lineNumber":80,"sourceCode":"\n                    GameSideNodeContainer.GetNode(parentEntity.Transform.Children).Add(gameSidePart.Transform);\n                }\n            });\n        }\n\n        /// <inheritdoc />\n        /// <seealso cref=\"SceneEditorGame.UnloadEntity\"/>\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(parent.Id.AssetId, 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 SceneRootViewModel)\n                {\n                    Game.UnloadEntity(part, parent.Id.ObjectId);\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":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/editor/Stride.Assets.Presentation/AssetEditors/SceneEditor/Services/SceneEditorController.cs#L62-L98","documentation":"SceneEditorController.RemovePart resolves the part to remove by constructing AbsoluteId(parent.Id.AssetId, assetSidePart.Id) and finding it game-side. It throws InvalidOperationException when that composite id matches no registered part, preventing removal of a non-existent game-side entity.","triggerScenarios":"RemovePart called where FindPart(new AbsoluteId(parent.Id.AssetId, assetSidePart.Id)) returns null — the asset-side part id does not correspond to any game-side entity (e.g. entity not yet loaded or already removed).","commonSituations":"Deleting an entity whose game-side representation was never created (add failed earlier or scene not loaded); duplicate delete events; asset ids changed after re-import.","solutions":["Confirm the part was successfully added game-side before attempting removal.","Guard with a FindPart check and skip removal when the part is absent (idempotent delete).","Refresh ids after asset reload so the composite AbsoluteId matches the registered part."],"exampleFix":"// before\ncontroller.RemovePart(parentViewModel, partViewModel); // may throw if not loaded\n// after\nvar partId = new AbsoluteId(parentViewModel.Id.AssetId, partViewModel.Id);\nif (controller.FindPart(partId) != null)\n    controller.RemovePart(parentViewModel, partViewModel);","handlingStrategy":"validation","validationCode":"var partId = new AbsoluteId(parent.Id.AssetId, part.Id);\nif (controller.FindPart(partId) == null)\n    return; // already removed or never loaded\nawait controller.RemovePart(parent, part);","typeGuard":"static bool PartExists(SceneEditorController c, AbsoluteId id) => c.FindPart(id) != null;","tryCatchPattern":"try { await controller.RemovePart(parent, part); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"does not correspond to any existing part\")) { log.Debug(\"Part already absent game-side; treating delete as idempotent.\"); }","preventionTips":["Make deletes idempotent — skip when FindPart returns null.","Avoid duplicate delete dispatches for the same part id.","Refresh part ids after asset reload before deleting."],"tags":["entity-not-found","scene-editor","part-lookup"],"backgroundTag":"entity-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"}