stride3d/stride · error · InvalidOperationException
The given does not correspond to any existing part.
Error message
The given {nameof(assetSidePart.Id)} does not correspond to any existing part. What it means
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.
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.
Example fix
// before
controller.RemovePart(partViewModel, parent);
// after
var partId = new AbsoluteId(AssetId.Empty, partViewModel.Id);
if (controller.FindPart(partId) != null)
controller.RemovePart(partViewModel, parent); Defensive patterns
Strategy: validation
Validate before calling
var partId = new AbsoluteId(AssetId.Empty, assetSidePart.Id); if (controller.FindPart(partId) == null) return; // already gone
Type guard
bool PartLoaded(AssetViewModel p) => p?.Id != null && controller.FindPart(new AbsoluteId(AssetId.Empty, p.Id)) != null;
Try / catch
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"); } Prevention
- 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
When it happens
Trigger: Calling RemovePart with an assetSidePart whose Id was never loaded, was already removed, or whose id no longer matches the game-side AbsoluteId mapping.
Common situations: Double-delete after an undo/redo; removing an entity whose game-side counterpart failed to load; stale viewmodel references after prefab reload.
Understand the failure class
Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.
Related errors
- The given does not correspond to any existing part.
- cannot be .
- The decimalPlaces should be greater or equal to zero.
- The minimum should be lesser or equal to the maximum.
- The smallStep should be lesser or equal to the largeStep.
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/08d8a9a6fafe9201.
Report an issue: GitHub.
Appendix: source
Thrown at sources/editor/Stride.Assets.Presentation/AssetEditors/PrefabEditor/Services/PrefabEditorController.cs:71
throw new InvalidOperationException($"The given {nameof(parent.Id)} does not correspond to any existing part.");
GameSideNodeContainer.GetNode(parentEntity.Transform.Children).Add(gameSidePart.Transform);
}
});
}
/// <inheritdoc />
public override Task RemovePart([NotNull] EntityHierarchyElementViewModel parent, Entity assetSidePart)
{
EnsureAssetAccess();
return InvokeAsync(() =>
{
Logger.Debug($"Removing entity {assetSidePart.Id} from game-side scene");
var partId = new AbsoluteId(AssetId.Empty, assetSidePart.Id);
var part = (Entity)FindPart(partId);
if (part == null)
throw new InvalidOperationException($"The given {nameof(assetSidePart.Id)} does not correspond to any existing part.");
if (parent is PrefabRootViewModel)
{
Game.UnloadEntity(part);
}
else
{
var parentEntity = (Entity)FindPart(parent.Id);
if (parentEntity == null)
throw new InvalidOperationException($"The given {nameof(parent.Id)} does not correspond to any existing part.");
var i = parentEntity.Transform.Children.IndexOf(part.Transform);
GameSideNodeContainer.GetNode(parentEntity.Transform.Children).Remove(part.Transform, new NodeIndex(i));
}
});
}
/// <summary>View on GitHub (pinned to 96fad776d2)