gfx-rs/wgpu · critical
No wgpu backend feature that is implemented for the target p
Error message
No wgpu backend feature that is implemented for the target platform was enabled. See `wgpu::Instance::enabled_backend_features()` for more information.
What it means
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.
Source
Thrown at wgpu/src/api/instance.rs:69
/// If no backend feature for the active target platform is enabled,
/// this method will panic, see [`Instance::enabled_backend_features()`].
fn default() -> Self {
// TODO: Differentiate constructors here too?
Self::new(InstanceDescriptor::new_without_display_handle())
}
}
impl Instance {
/// Create an new instance of wgpu using the given options and enabled backends.
///
/// # Panics
///
/// - If no backend feature for the active target platform is enabled,
/// this method will panic; see [`Instance::enabled_backend_features()`].
#[allow(clippy::allow_attributes, unreachable_code)]
pub fn new(desc: InstanceDescriptor) -> Self {
if Self::enabled_backend_features().is_empty() {
panic!(
"No wgpu backend feature that is implemented for the target platform was enabled. \
See `wgpu::Instance::enabled_backend_features()` for more information."
);
}
#[cfg(webgpu)]
{
let is_only_available_backend = !cfg!(wgpu_core);
let requested_webgpu = desc.backends.contains(Backends::BROWSER_WEBGPU);
let support_webgpu = crate::backend::get_browser_gpu_property()
.map(|maybe_gpu| maybe_gpu.is_some())
.unwrap_or(false);
if is_only_available_backend || (requested_webgpu && support_webgpu) {
return Self {
inner: crate::backend::ContextWebGpu::new(desc).into(),
};
}View on GitHub (pinned to 3e11ff59bf)
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.
Example fix
// before (Cargo.toml)
wgpu = { version = "25", default-features = false }
// after
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
wgpu = { version = "25", default-features = false, features = ["vulkan", "metal"] } Defensive patterns
Strategy: validation
Validate before calling
if wgpu::Instance::enabled_backend_features().is_empty() {
return Err("no wgpu backend enabled for this platform; enable a backend cargo feature".into());
} Try / catch
let result = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| wgpu::Instance::new(desc)));
Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- source slice length ({src_len}) does not match destination s
- mid > len
- split_off() requires a one-sided range
- slice offset {slice_offset} is out of range for buffer of si
- slice offset {slice_offset} size {slice_size} is out of rang
AI-assisted analysis of gfx-rs/wgpu@3e11ff59bf (2026-09-03).
Data as JSON: /api/errors/fc35bb05361d6c6e.
Report an issue: GitHub.