stride3d/stride · error · InvalidOperationException
The service [ ] requires a service of type [ ] to be…
Error message
The service [{service.GetType().Name}] requires a service of type [{dependency.Name}] to be initialized first. What it means
EntityHierarchyEditorGame.LoadContent initializes editor services in dependency order (OrderByDependency). Before initializing each service it verifies every declared dependency type is present in the already-initialized list; if not, an InvalidOperationException is thrown, because initializing a service without its dependency would leave it broken.
Solutions
- Register all services listed in the failing service's Dependencies before it in the editor game service collection
- Check logs to see why the dependency's InitializeService returned false and fix that root cause
- Ensure the dependency type matches exactly the interface/class declared in Dependencies
- Verify no custom OrderByDependency/regISTRATION code filters out the dependency
Example fix
// before editorGame.EditorServices.Add(new EditorGameNavigationMeshService()); // depends on GameSettingsProviderService // after editorGame.EditorServices.Add(new GameSettingsProviderService(...)); editorGame.EditorServices.Add(new EditorGameNavigationMeshService());
Defensive patterns
Strategy: validation
Validate before calling
var missing = service.Dependencies.Where(d => !editorGame.EditorServices.Any(s => d.IsInstanceOfType(s))).ToList();
if (missing.Any()) throw new InvalidOperationException("Unregistered dependencies: " + string.Join(",", missing)); Try / catch
try { await editorGame.LoadContent(); }
catch (InvalidOperationException ex) { log.Critical(ex); DisableEditorServices(); } Prevention
- Register every service listed in a service's Dependencies
- Check InitializeService return values; a false return cascades to dependent failures
- Keep dependency declarations minimal and documented
When it happens
Trigger: Registering an editor service whose Dependencies include a type that is never registered or whose initializing service failed (InitializeService returned false, so it was not added to initialized).
Common situations: Forgetting to register a dependency service in the editor game setup; a required service's InitializeService returning false (e.g. missing game settings) so the dependent cannot initialize; wrong registration order in custom editor bootstraps.
Understand the failure class
Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.
Related errors
- IEntityGizmo ' ' must have a constructor with exactly one…
- The given type is not an EntityComponent type
- This operation is not supported.
- game is not of type EntityHierarchyEditorGame
- The ContentScene has not been initialized yet.
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/3799b09b8889f288.
Report an issue: GitHub.
Appendix: source
Thrown at sources/editor/Stride.Assets.Presentation/AssetEditors/EntityHierarchyEditor/Game/EntityHierarchyEditorGame.cs:307
Diffuse = new MaterialDiffuseMapFeature(new ComputeTextureColor { FallbackValue = null }), // Do not use fallback value, we want a DiffuseMap
DiffuseModel = new MaterialDiffuseLambertModelFeature()
}
});
// Listen to all Renderer Initialized to plug dynamic effect compilation
RenderContext.GetShared(Services).RendererInitialized += SceneGameRendererInitialized;
// Update the marker render target setter viewport
//OnClientSizeChanged(this, EventArgs.Empty);
// Initialize the services
var initialized = new List<IEditorGameService>();
foreach (var service in EditorServices.OrderByDependency())
{
// Check that the current service dependencies have been initialized
foreach (var dependency in service.Dependencies)
{
if (!initialized.Any(x => dependency.IsInstanceOfType(x)))
throw new InvalidOperationException($"The service [{service.GetType().Name}] requires a service of type [{dependency.Name}] to be initialized first.");
}
if (await service.InitializeService(this))
{
initialized.Add(service);
}
var mouseService = service as EditorGameMouseServiceBase;
mouseService?.RegisterMouseServices(EditorServices);
}
// TODO: Maybe define this scene default graphics compositor as an asset?
var defaultGraphicsCompositor = GraphicsCompositorHelper.CreateDefault(true, EditorGraphicsCompositorHelper.EditorForwardShadingEffect);
// Add UI (engine doesn't depend on it)
defaultGraphicsCompositor.RenderFeatures.Add(new UIRenderFeature
{
RenderStageSelectors =
{View on GitHub (pinned to 96fad776d2)