gfx-rs/wgpu · error

${name} is not core

Error message

${name} is not core

What it means

Panic from the macro-generated as_core() accessor on a dispatch enum: the value is the WebGPU or Custom variant, not Core. It fires when a backend-specific accessor is called on an object created by a different backend; the faulty input is the non-Core dispatch value.

Source

Thrown at wgpu/src/dispatch.rs:822

        #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone)]
        pub enum $name {
            #[cfg(wgpu_core)]
            Core($core_type),
            #[cfg(webgpu)]
            WebGPU($webgpu_type),
            #[allow(clippy::allow_attributes, private_interfaces)]
            #[cfg(custom)]
            Custom($custom_type),
        }

        impl $name {
            #[cfg(wgpu_core)]
            #[inline]
            #[allow(clippy::allow_attributes, unused)]
            pub fn as_core(&self) -> &$core_type {
                match self {
                    Self::Core(value) => value,
                    _ => panic!(concat!(stringify!($name), " is not core")),
                }
            }

            #[cfg(wgpu_core)]
            #[inline]
            #[allow(clippy::allow_attributes, unused)]
            pub fn as_core_opt(&self) -> Option<&$core_type> {
                match self {
                    Self::Core(value) => Some(value),
                    _ => None,
                }
            }

            #[cfg(custom)]
            #[inline]
            #[allow(clippy::allow_attributes, unused)]
            pub fn as_custom<T: $interface>(&self) -> Option<&T> {
                match self {

View on GitHub (pinned to 3e11ff59bf)

Solutions

  1. Verify which backend produced the object before calling as_core()
  2. Design call sites to keep objects within one backend context
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at wgpu/src/dispatch.rs:822 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of gfx-rs/wgpu@3e11ff59bf (2026-09-03). Data as JSON: /api/errors/4d014776849b9a29. Report an issue: GitHub.