DOMException with createDefaultXRExperienceAsync

sorry to bother but:
open Babylon.js Playground and the devtools:

Uncaught (in promise) DOMException: An attempt was made to use an object that is not, or is no longer, usable.

happens only with babylon > v7


I had the same issue a few times before. I couldn’t find the reason, but restarting the browser usually is enough to fix it

Is it reproducible just by opening the playground? or do I need to try entering XR? Can you share a bit of info about your environment? what browser/system? Go the WebXR emulator installed? any XR flags turned on?

Oh! and could you share a stacktrace, if possible?

you have to try entering xr, but it really did not always happen so quite hard to reproduce :confused: (I can’t reproduce it anymore) I was using chrome on windows, but with a custom OpenXR runtime so I thought that was the issue at the time.

1 Like

Thanks for the quick reply.

Just open the PG without VR device attached
on windows 10 with all chrome based browsers: chrome, canary, edge , brave
no flags no emulator. restart browser does not help.
Other Errors with firefox:

  • Error initializing XR [babylon.js:1:188864]
  • WebXR not available

The scenes are running fine, so not that big issue but worrying.
I use/test my scenes also in desktop mode
No error in console on quest with devtools via USB
It looks like some check for XR device is gone

On debug i end up arround:

    _makeCanvasCompatibleAsync() {
        this._canvasCompatiblePromise = new Promise((resolve) => {
            if (this.canvasContext && this.canvasContext.makeXRCompatible) {
                this.canvasContext.makeXRCompatible().then(() => {
            else {

resolves are never hit.
I can debug further but hope it is easy for somebody who knows the internals .

This is a cought exception when trying to initialize WebXR in environments that don’t have WebXR. The scene will continue to render, as you say, mainly because the exception is caught (but logged). But this is not the error you pasted initially, right? or is it related?

The DOMException is the Error i get if no XR device is attached

So that means you do not get this Error on your device/system ?


It’s interesting. I don’t, though I don’t have XR enabled (it’s a mac). But i’ll check and see if I can avoid showing all of those errors when XR is not available

I just updated an older babylon project (babylon 5) to the latest (7.9) and am now getting this error. Though other things may be broken as well.

I have another project that is 7.9 that does not get this error though.