stride3d/stride · error · InvalidOperationException

The passthrough mode needs to be enabled at device creation

Error message

The passthrough mode needs to be enabled at device creation

What it means

OpenXRHmd.StartPassthrough() throws this InvalidOperationException when passthrough was never requested at device creation (passthroughRequested is false). Passthrough requires the FB passthrough extension to be initialized during HMD creation, so it cannot be turned on lazily afterwards. The library deliberately fails fast because the extension setup cannot be retrofitted on an already-created OpenXR session.

Solutions

  1. Enable passthrough at device creation: set the passthrough request flag in the VR device / OpenXR device description before the HMD is created.
  2. If the device was already created, recreate it with passthrough requested, then call StartPassthrough().
  3. Check SupportsPassthrough first and degrade gracefully when the device cannot do passthrough at all.

Example fix

// before
var hmd = game.VRDevice; // created without passthrough
hmd.StartPassthrough(); // throws InvalidOperationException
// after
var deviceDescription = new VRDeviceDescription { RequestPassthrough = true };
var hmd = (OpenXRHmd)game.CreateVRDevice(deviceDescription);
hmd.StartPassthrough();
Defensive patterns

Strategy: validation

Validate before calling

if (hmd is OpenXRHmd ox && !ox.SupportsPassthrough) throw new SkipPassthroughException();
// ensure passthrough was requested at device creation before calling StartPassthrough

Type guard

bool CanStartPassthrough(OpenXRHmd hmd) => hmd.SupportsPassthrough;

Prevention

When it happens

Trigger: Calling StartPassthrough() on an OpenXR HMD that was created without enabling/requesting passthrough support in the device-creation settings.

Common situations: Adding passthrough to an existing VR app without touching the VR device configuration; toggling passthrough at runtime on a headset that was initialized with passthrough disabled; copying sample code that assumes passthrough was requested up front.

Related errors


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

Appendix: source

Thrown at sources/engine/Stride.VirtualReality/OpenXR/OpenXRHmd.cs:386

                CountActionSets = 1,
                ActionSets = &gameplay_actionset
            };

            Xr.AttachSessionActionSets(session, &actionset_attach_info).CheckResult();

            // figure out what interaction profile we are using, and determine if it has a touchpad/thumbstick or both
            handProfileState = new InteractionProfileState()
            {
                Type = StructureType.InteractionProfileState,
                Next = null
            };
            Xr.StringToPath(Instance, "/user/hand/left", ref leftHandPath);
        }

        public override IDisposable StartPassthrough()
        {
            if (!passthroughRequested)
                throw new InvalidOperationException("The passthrough mode needs to be enabled at device creation");

            if (!SupportsPassthrough)
                throw new NotSupportedException("The device does not support passthrough mode");

            if (passthroughExt is null)
                passthroughExt = new OpenXRExt_FB_Passthrough(Xr, globalSession, Instance);

            if (passthroughExt.Enabled)
                throw new InvalidOperationException("Passthrough already started");

            passthroughExt.Enabled = true;

            return new AnonymousDisposable(() => passthroughExt.Enabled = false);
        }

        private void EndNullFrame()
        {
            FrameEndInfo frame_end_info = new FrameEndInfo()

View on GitHub (pinned to 96fad776d2)