{"record":{"id":"b5aff0ae475931cb","repo":"BabylonJS/Babylon.js","slug":"anchors-are-not-enabled-in-your-browser","errorCode":null,"errorMessage":"Anchors are not enabled in your browser","messagePattern":"Anchors are not enabled in your browser","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/dev/core/src/XR/features/WebXRAnchorSystem.pure.ts","lineNumber":589,"sourceCode":"                // Logger.Warn(\"Please provide a world parent node to apply world transformation\");\r\n            } else {\r\n                mat.multiplyToRef(this._options.worldParentNode.getWorldMatrix(), mat);\r\n            }\r\n        }\r\n\r\n        return <IWebXRAnchor>anchor;\r\n    }\r\n\r\n    private async _createAnchorAtTransformationAsync(xrTransformation: XRRigidTransform, xrFrame: XRFrame) {\r\n        if (xrFrame.createAnchor) {\r\n            try {\r\n                return await xrFrame.createAnchor(xrTransformation, this._referenceSpaceForFrameAnchors ?? this._xrSessionManager.referenceSpace);\r\n            } catch (error) {\r\n                throw new Error(String(error), { cause: error });\r\n            }\r\n        } else {\r\n            this.detach();\r\n            throw new Error(\"Anchors are not enabled in your browser\");\r\n        }\r\n    }\r\n}\r\n\r\nlet _Registered = false;\r\n/**\r\n * Register side effects for webXRAnchorSystem.\r\n * Safe to call multiple times; only the first call has an effect.\r\n */\r\nexport function RegisterWebXRAnchorSystem(): void {\r\n    if (_Registered) {\r\n        return;\r\n    }\r\n    _Registered = true;\r\n\r\n    // register the plugin\r\n    WebXRFeaturesManager.AddWebXRFeature(\r\n        WebXRAnchorSystem.Name,\r","sourceCodeStart":571,"sourceCodeEnd":607,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/core/src/XR/features/WebXRAnchorSystem.pure.ts#L571-L607","documentation":"_createAnchorAtTransformationAsync requires XRFrame.createAnchor; when the browser does not implement it, the method first detaches the anchor feature and throws this Error. It indicates the current browser/session cannot create frame-based XR anchors at all.","triggerScenarios":"Requesting an anchor (via xrAnchor() or the anchor system's frame loop) on a browser or XR runtime without XRFrame.createAnchor support (no WebXR anchors module).","commonSituations":"Desktop browsers or older headsets lacking the WebXR anchors API; entering an immersive session where 'anchors' was not requested/granted so createAnchor is never exposed; using a polyfill that omits anchors.","solutions":["Check support before enabling: `if (!xrFrame.createAnchor)` or check WebXR 'anchors' feature availability, and provide a non-anchor fallback.","Request the 'anchors' feature in the session (WebXRAnchorSystem name/requiredFeatures) with a browser that implements it.","Use a device/browser that supports WebXR anchors (recent Quest browser, ChromeOS/Android Chrome with ARCore, etc.).","Catch the error and disable anchor-dependent functionality gracefully (the feature is detached automatically)."],"exampleFix":"// before\nconst anchor = await anchors.addAnchorAtTransformationAsync(matrix);\n// after\nconst session = xrSessionManager.session;\nconst supportsAnchors = typeof XRFrame !== \"undefined\" && XRFrame.prototype?.createAnchor;\nif (!supportsAnchors) {\n    console.warn(\"WebXR anchors unsupported; using local tracking only\");\n} else {\n    const anchor = await anchors.addAnchorAtTransformationAsync(matrix);\n}","handlingStrategy":"fallback","validationCode":"const anchorsSupported = typeof XRFrame !== \"undefined\" && typeof (XRFrame.prototype as any)?.createAnchor === \"function\";\nif (!anchorsSupported) { /* use non-anchor fallback */ }","typeGuard":"function supportsXRFrameAnchors(): boolean {\n    return typeof XRFrame !== \"undefined\" && typeof (XRFrame.prototype as any).createAnchor === \"function\";\n}","tryCatchPattern":"try {\n    return await anchors.addAnchorAtTransformationAsync(matrix);\n} catch (e) {\n    if (String((e as Error).message).includes(\"Anchors are not enabled\")) {\n    return fallbackLocalTracking(matrix);\n    }\n    throw e;\n}","preventionTips":["Check XRFrame.prototype.createAnchor before enabling the anchor feature","Request the WebXR 'anchors' feature in the session and verify grants","Maintain a fallback tracking path for browsers without anchors","Test on the minimum device/browser set you plan to ship"],"tags":["webxr","anchors","browser-support"],"backgroundTag":"webxr-api-not-supported","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}