stride3d/stride · error · InvalidOperationException

No scene match the given

Error message

No scene match the given {sceneId}

What it means

SceneEditorGame.GetScene looks up the game-side Scene instance for a sceneId in its internal scenes dictionary and throws InvalidOperationException when no scene with that id is registered. It is the central resolution point for child scenes loaded into the editor's game session.

Solutions

  1. Ensure the child scene is loaded (EnsureContentScene / the scene-loading path) before performing entity operations against its id.
  2. Refresh stale scene ids after asset reload by re-resolving them from the current asset collection.
  3. Check SceneEditorGame.IsSceneLoaded (or equivalent tracking) before calling, or wrap calls in try/catch on InvalidOperationException.

Example fix

// before
var scene = game.GetScene(asset.Id); // asset may not be loaded game-side
// after
if (!game.IsSceneLoaded(asset.Id))
    await game.LoadSceneAndWait(asset);
var scene = game.GetScene(asset.Id);
Defensive patterns

Strategy: try-catch

Validate before calling

// track loaded scenes yourself before calling APIs that resolve by id
if (!loadedSceneIds.Contains(sceneId))
    await LoadSceneAsync(sceneAsset);

Type guard

bool SceneIsLoaded(SceneEditorGame game, Guid sceneId) => game.IsSceneLoaded(sceneId); // or maintain your own set of loaded ids

Try / catch

try { var scene = editorGame.GetScene(sceneId); /* use scene */ }
catch (InvalidOperationException ex) when (ex.Message.StartsWith("No scene match")) { await ReloadSceneAsync(sceneId); }

Prevention

When it happens

Trigger: Calling LoadEntity/UnloadEntity/UnloadEntities (or scene offset sync paths via parent/scene/newParent/anchor) with a sceneId that was never passed to the scene-loading API, or that was loaded then unloaded.

Common situations: Operating on a child scene whose load operation has not completed yet; referencing a scene asset that was reloaded/re-imported and received a new id; stale references after a scene was removed from the hierarchy.

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/837b26e49572a351. Report an issue: GitHub.

Appendix: source

Thrown at sources/editor/Stride.Assets.Presentation/AssetEditors/SceneEditor/Game/SceneEditorGame.cs:249

            // Find virtual anchor
            var anchorIndex = parent.Entities.IndexOf(x => x.Id == scene.Id);
            if (anchorIndex != -1)
            {
                var anchorEntity = parent.Entities[anchorIndex].Components.OfType<VirtualAnchorScript>().FirstOrDefault();
                // Remove anchor script
                if (anchorEntity != null)
                    Script.Remove(anchorEntity);
                // Remove virtual anchor
                parent.Entities.RemoveAt(anchorIndex);
            }
        }

        [NotNull]
        private Scene GetScene(Guid sceneId)
        {
            if (!scenes.TryGetValue(sceneId, out Scene scene))
                throw new InvalidOperationException($"No scene match the given {sceneId}");

            return scene;
        }

        /// <summary>
        /// Script that synchronizes the scene offset to the virtual anchor position.
        /// </summary>
        /// <remarks>
        /// We use an indirection with a virtual anchor to be able to display a gizmo that the user can manipulate.
        /// In a real game, this indirection is not needed, and the scene offset should be directly modified instead.
        /// </remarks>
        private class VirtualAnchorScript : AsyncScript
        {
            private new SceneEditorGame Game => (SceneEditorGame)base.Game;

            /// <inheritdoc />
            public override async Task Execute()
            {

View on GitHub (pinned to 96fad776d2)