BabylonJS/Babylon.js · error
Error in provided version - ${name} (${version})
Error message
Error in provided version - ${name} (${version}) What it means
enableFeature resolves a string version to a numeric version. An empty string version (falsy) can never resolve, so Babylon throws `Error in provided version - <name> (<version>)` immediately. It is a guard against passing an invalid/empty version string to the features manager.
Source
Thrown at packages/dev/core/src/XR/webXRFeaturesManager.ts:564
* @param version optional version to load. if not provided the latest version will be enabled
* @param moduleOptions options provided to the module. Ses the module documentation / constructor
* @param attachIfPossible if set to true (default) the feature will be automatically attached, if it is currently possible
* @param required is this feature required to the app. If set to true the session init will fail if the feature is not available.
* @returns a new constructed feature or throws an error if feature not found or conflicts with another enabled feature.
*/
public enableFeature<T extends WebXRFeatureNameType>(
// eslint-disable-next-line @typescript-eslint/naming-convention
featureName: T | { Name: T },
version: number | string = "latest",
moduleOptions: ResolveWebXRFeatureOptions<T> = {} as ResolveWebXRFeatureOptions<T>,
attachIfPossible: boolean = true,
required: boolean = true
): ResolveWebXRFeature<T> {
const name = typeof featureName === "string" ? featureName : featureName.Name;
let versionToLoad: number;
if (typeof version === "string") {
if (!version) {
throw new Error(`Error in provided version - ${name} (${version})`);
}
if (version === "stable") {
versionToLoad = WebXRFeaturesManager.GetStableVersionOfFeature(name);
} else if (version === "latest") {
versionToLoad = WebXRFeaturesManager.GetLatestVersionOfFeature(name);
} else {
// try loading the number the string represents
versionToLoad = +version;
}
if (versionToLoad === -1 || isNaN(versionToLoad)) {
throw new Error(`feature not found - ${name} (${version})`);
}
} else {
versionToLoad = version;
}
// check if there is a feature conflict
const conflictingFeature = WebXRFeaturesManager._ConflictingFeatures[name];
View on GitHub (pinned to 0592b347b8)
Solutions
- Omit the version argument or pass "latest"/"stable" instead of an empty string.
- Fix the source of the empty version variable (config/env lookup) before calling enableFeature.
- Validate the version string is non-empty (and "stable"|"latest"|numeric) before calling.
- Convert numeric-string versions to numbers yourself and pass a number if that is the intent.
Example fix
// before
xr.enableFeature(WebXRFeatureName.LAYERS, config.xrLayerVersion || "");
// after
const version = config.xrLayerVersion && !isNaN(+config.xrLayerVersion)
? +config.xrLayerVersion
: "latest";
xr.enableFeature(WebXRFeatureName.LAYERS, version); Defensive patterns
Strategy: validation
Validate before calling
function assertValidVersion(name: string, version?: number | string): number | string {
if (typeof version === "string" && !version) throw new Error(`enableFeature: empty version for ${name}`);
return version ?? "latest";
} Try / catch
try {
xr.enableFeature(featureName, version);
} catch (e) {
if (String((e as Error).message).startsWith("Error in provided version")) {
console.warn("Invalid version; retrying with latest");
xr.enableFeature(featureName, "latest");
} else { throw e; }
} Prevention
- Never pass "" as a version; omit it or use "latest"/"stable"
- Validate dynamic version strings against /^(stable|latest|\d+)$/ before calling
- Fix config/env lookups so version variables cannot be empty
- Add unit tests covering version resolution in feature-enabling helpers
When it happens
Trigger: Calling xrSessionManager.enableFeature(featureName, "") — an empty-string version — from application code or from a helper (e.g. layers/enabledFeature wrappers) that propagates an unset version string.
Common situations: A variable holding the version is empty due to failed config lookup or env substitution; passing a dynamic version string built at runtime that ended up empty; confusing the API by passing an empty string instead of omitting the argument (default is "latest").
Related errors
- feature not found
- Unable to generateSoloNavMesh: ${result.error}
- Invalid Space Warp framebuffer
- Multiview is not supported
- Unsupported buffer type
AI-assisted analysis of BabylonJS/Babylon.js@0592b347b8 (2026-08-30).
Data as JSON: /api/errors/0752e79bb41ecac6.
Report an issue: GitHub.