stride3d/stride · error · ArgumentException
Don't know button:
Error message
Don't know button:
What it means
OpenXRInput.GetAction maps a TouchControllerButton enum value to an OpenXR action using a switch over known buttons; the default branch throws ArgumentException because the button value is not handled by the mapping table. This happens when an enum value is passed that has no corresponding HAND_PATHS entry. The exception fires during GetActionBool or GetActionFloat calls.
Solutions
- Pass only TouchControllerButton values the input mapping supports (Trigger, Thumbstick, Touchpad, etc.).
- Validate the button value before calling and fall back for unmapped buttons.
- Upgrade Stride if the button you need was added in a newer version's mapping table.
Example fix
// before
var pressed = input.GetActionBool(hand, (TouchControllerButton)rawValue);
// after
if (Enum.IsDefined(typeof(TouchControllerButton), rawValue) &&
rawValue is TouchControllerButton.Trigger or TouchControllerButton.Thumbstick or TouchControllerButton.Touchpad)
{
var pressed = input.GetActionBool(hand, (TouchControllerButton)rawValue);
} Defensive patterns
Strategy: validation
Validate before calling
if (!Enum.IsDefined(typeof(TouchControllerButton), button)) return fallback; var state = input.GetActionBool(hand, button, out var changed, fallback);
Type guard
bool IsMappedButton(TouchControllerButton b) =>
b is TouchControllerButton.Trigger or TouchControllerButton.Thumbstick or TouchControllerButton.Touchpad; Try / catch
try { state = input.GetActionBool(hand, button, out changed); }
catch (ArgumentException) { state = fallback; } Prevention
- Only pass TouchControllerButton values supported by the Stride version's input mapping.
- Never cast unchecked ints into TouchControllerButton without Enum.IsDefined.
- Update Stride when new buttons are needed.
When it happens
Trigger: Calling GetActionBool/GetActionFloat with a TouchControllerButton value that the switch statement does not cover (e.g. newly added or cast-in enum values like (TouchControllerButton)99).
Common situations: Casting raw ints or values from config/UI into TouchControllerButton; a Stride version mismatch where code passes a newer enum member than the input mapping supports; iterating all enum values assuming each is mapped.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- OpenXR error! Current implementation doesn't support…
- OpenXR is only compatible with DirectX11
- Passthrough already started
- The current device doesn't support primary stereo
- The device does not support passthrough mode
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/c41b0445512bc763.
Report an issue: GitHub.
Appendix: source
Thrown at sources/engine/Stride.VirtualReality/OpenXR/OpenXRInput.cs:149
case TouchControllerButton.A:
return MappedActions[(int)hand, (int)HAND_PATHS.ButtonXA];
case TouchControllerButton.Y:
case TouchControllerButton.B:
return MappedActions[(int)hand, (int)HAND_PATHS.ButtonYB];
case TouchControllerButton.Grip:
return wantBoolean ? MappedActions[(int)hand, (int)HAND_PATHS.GripClick] : MappedActions[(int)hand, (int)HAND_PATHS.GripValue];
case TouchControllerButton.Menu:
return MappedActions[(int)hand, (int)HAND_PATHS.Menu];
//case TouchControllerButton.System:
// return MappedActions[(int)hand, (int)HAND_PATHS.System];
case TouchControllerButton.Trigger:
return wantBoolean ? MappedActions[(int)hand, (int)HAND_PATHS.TriggerClick] : MappedActions[(int)hand, (int)HAND_PATHS.TriggerValue];
case TouchControllerButton.Thumbstick:
return wantBoolean ? MappedActions[(int)hand, (int)HAND_PATHS.ThumbstickClick] : MappedActions[(int)hand, YAxis ? (int)HAND_PATHS.ThumbstickY : (int)HAND_PATHS.ThumbstickX];
case TouchControllerButton.Touchpad:
return wantBoolean ? MappedActions[(int)hand, (int)HAND_PATHS.TrackpadClick] : MappedActions[(int)hand, YAxis ? (int)HAND_PATHS.TrackpadY : (int)HAND_PATHS.TrackpadX];
default:
throw new ArgumentException("Don't know button: " + button);
}
}
public bool GetActionBool(TouchControllerHand hand, TouchControllerButton button, out bool wasChangedSinceLast, bool fallback = false)
{
ActionStateGetInfo getbool = new ActionStateGetInfo()
{
Action = GetAction(hand, button, false, true),
Type = StructureType.ActionStateGetInfo
};
ActionStateBoolean boolresult = new ActionStateBoolean()
{
Type = StructureType.ActionStateBoolean
};
hmd.Xr.GetActionStateBoolean(hmd.globalSession, in getbool, ref boolresult);
View on GitHub (pinned to 96fad776d2)