stride3d/stride · error · InvalidOperationException

The event type was not registered with the input manager…

Error message

The event type {evt.GetType()} was not registered with the input manager and cannot be processed

What it means

During InputManager.Update, queued input events are dispatched to per-type IInputEventRouter instances. If an event type has no registered router in eventRouters, Stride cannot route it and throws InvalidOperationException, indicating an internal registration inconsistency between the event producer and the manager.

Solutions

  1. Ensure the input source's event types are registered with the InputManager (use the standard source registration path, Sources.Add).
  2. Update Stride to a version matching your platform backend packages.
  3. Remove or fix custom input sources that enqueue unregistered event types.

Example fix

// before
customSource.Enqueue(new MyCustomInputEvent(...)); // type never registered
// after
// use built-in event types or register the router for the custom type
inputManager.Sources.Add(customSource); // standard registration wires up event routing
Defensive patterns

Strategy: try-catch

Validate before calling

// ensure sources are registered through InputManager.Sources before enabling updates
bool ok = input.Sources.Contains(mySource);

Try / catch

try { input.Update(gameTime); }
catch (InvalidOperationException ex) when (ex.Message.Contains("was not registered"))
{ logger.Error(ex, "Unregistered input event type; re-adding source"); input.Sources.Add(mySource); }

Prevention

When it happens

Trigger: Calling Update when the events queue contains an event type whose router was never registered via the internal eventRouters setup — typically after a custom input source enqueues events without registering its event type.

Common situations: Custom IInputSource implementations pushing raw events into the manager; a platform backend producing a new event type unsupported by the current InputManager version.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14). Data as JSON: /api/errors/edfa00388f32a3f6. Report an issue: GitHub.

Appendix: source

Thrown at sources/engine/Stride.Input/InputManager.cs:452

            {
                source.Update();
            }

            // Update all input sources so they can send events and update their state
            foreach (var inputDevice in devices)
            {
                inputDevice.Update(events);
            }

            // Notify PreUpdateInput
            PreUpdateInput?.Invoke(this, new InputPreUpdateEventArgs { GameTime = gameTime });
            
            // Send events to input listeners
            foreach (var evt in events)
            {
                IInputEventRouter router;
                if (!eventRouters.TryGetValue(evt.GetType(), out router))
                    throw new InvalidOperationException($"The event type {evt.GetType()} was not registered with the input manager and cannot be processed");

                router.RouteEvent(evt);
            }

            // Update virtual buttons
            UpdateVirtualButtonStates();

            // Update gestures
            UpdateGestureEvents(gameTime.Elapsed);
        }

        /// <summary>
        /// Registers an object that listens for certain types of events using the specialized versions of <see cref="IInputEventListener&lt;"/>
        /// </summary>
        /// <param name="listener">The listener to register</param>
        public void AddListener(IInputEventListener listener)
        {
            foreach (var router in eventRouters)

View on GitHub (pinned to 96fad776d2)