{"record":{"id":"fc35bb05361d6c6e","repo":"gfx-rs/wgpu","slug":"no-wgpu-backend-feature-that-is-implemented-for-th","errorCode":null,"errorMessage":"No wgpu backend feature that is implemented for the target platform was enabled. See `wgpu::Instance::enabled_backend_features()` for more information.","messagePattern":"No wgpu backend feature that is implemented for the target platform was enabled\\. See `wgpu::Instance::enabled_backend_features\\(\\)` for more information\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"wgpu/src/api/instance.rs","lineNumber":69,"sourceCode":"    /// If no backend feature for the active target platform is enabled,\n    /// this method will panic, see [`Instance::enabled_backend_features()`].\n    fn default() -> Self {\n        // TODO: Differentiate constructors here too?\n        Self::new(InstanceDescriptor::new_without_display_handle())\n    }\n}\n\nimpl Instance {\n    /// Create an new instance of wgpu using the given options and enabled backends.\n    ///\n    /// # Panics\n    ///\n    /// - If no backend feature for the active target platform is enabled,\n    ///   this method will panic; see [`Instance::enabled_backend_features()`].\n    #[allow(clippy::allow_attributes, unreachable_code)]\n    pub fn new(desc: InstanceDescriptor) -> Self {\n        if Self::enabled_backend_features().is_empty() {\n            panic!(\n                \"No wgpu backend feature that is implemented for the target platform was enabled. \\\n                 See `wgpu::Instance::enabled_backend_features()` for more information.\"\n            );\n        }\n\n        #[cfg(webgpu)]\n        {\n            let is_only_available_backend = !cfg!(wgpu_core);\n            let requested_webgpu = desc.backends.contains(Backends::BROWSER_WEBGPU);\n            let support_webgpu = crate::backend::get_browser_gpu_property()\n                .map(|maybe_gpu| maybe_gpu.is_some())\n                .unwrap_or(false);\n\n            if is_only_available_backend || (requested_webgpu && support_webgpu) {\n                return Self {\n                    inner: crate::backend::ContextWebGpu::new(desc).into(),\n                };\n            }","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/gfx-rs/wgpu/blob/3e11ff59bf3f9795d285ecc045014089640d7248/wgpu/src/api/instance.rs#L51-L87","documentation":"Instance::new panics when no backend feature implemented for the current target platform is enabled in the wgpu crate's cargo features. wgpu is compiled with zero usable backends (e.g. only vulkan enabled while building for macOS/web), so it cannot create any instance.","triggerScenarios":"Creating an Instance (Instance::new / Instance::default) on a platform whose backend cargo feature is not enabled — e.g. default-features = false without adding metal/vulkan/gl/webgpu/webgpu-webrender-sys, or a wasm build missing the webgpu feature.","commonSituations":"Cross-compiling to a new target without updating feature flags; disabling default features to trim the build; CI matrix runs on an OS not covered by the enabled backends; wasm-pack builds missing web-sys/webgpu features.","solutions":["Enable the backend feature matching your platform: vulkan, metal, gl, dx12, or webgpu (see Instance::enabled_backend_features()).","If using default-features = false, re-add the appropriate backend features in Cargo.toml.","Gate backend features per target in Cargo.toml with [target.'cfg(...)'.dependencies] so each platform gets its backend."],"exampleFix":"// before (Cargo.toml)\nwgpu = { version = \"25\", default-features = false }\n// after\n[target.'cfg(not(target_arch = \"wasm32\"))'.dependencies]\nwgpu = { version = \"25\", default-features = false, features = [\"vulkan\", \"metal\"] }","handlingStrategy":"validation","validationCode":"if wgpu::Instance::enabled_backend_features().is_empty() {\n    return Err(\"no wgpu backend enabled for this platform; enable a backend cargo feature\".into());\n}","typeGuard":null,"tryCatchPattern":"let result = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| wgpu::Instance::new(desc)));","preventionTips":["Enable at least one backend feature per target platform in Cargo.toml.","Test every CI target (desktop OSes, wasm) after changing feature flags.","Avoid default-features = false unless you re-add platform backends."],"tags":["panic","rust","cargo-features","configuration","instance-creation"],"backgroundTag":"missing-feature-flag","analyzedSha":"3e11ff59bf3f9795d285ecc045014089640d7248","analyzedAt":"2026-09-03T01:43:21.459Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T07:17:11.731Z"}