tracel-ai/burn · error

BURN_DEVICE=cpu requested, but the 'cpu' feature is not enab

Error message

BURN_DEVICE=cpu requested, but the 'cpu' feature is not enabled.

What it means

BURN_DEVICE selection guard for `cpu`: returns the CPU cube backend only when the `cpu` feature is compiled; otherwise panics. Fires when the environment requests CPU execution from a build that excluded the CPU backend.

Source

Thrown at crates/burn-dispatch/src/device.rs:261

                            "BURN_DEVICE=rocm requested, but the 'rocm' feature is not enabled."
                        );
                    }
                    "metal" | "vulkan" | "webgpu" | "wgpu" => {
                        #[cfg(any(
                            feature = "metal",
                            feature = "vulkan",
                            feature = "webgpu",
                            feature = "wgpu"
                        ))]
                        return Self::Cube(CubeDevice::Wgpu(Default::default()));
                        panic!(
                            "BURN_DEVICE={device_str} requested, but no wgpu feature is enabled."
                        );
                    }
                    "cpu" => {
                        #[cfg(feature = "cpu")]
                        return Self::Cube(CubeDevice::Cpu(Default::default()));
                        panic!("BURN_DEVICE=cpu requested, but the 'cpu' feature is not enabled.");
                    }
                    "tch" => {
                        #[cfg(feature = "tch")]
                        return Self::LibTorch(LibTorchDevice::default());
                        panic!("BURN_DEVICE=tch requested, but the 'tch' feature is not enabled.");
                    }
                    "remote" => {
                        #[cfg(feature = "remote")]
                        return Self::Remote(RemoteDevice::default());
                        panic!(
                            "BURN_DEVICE=remote requested, but the 'remote' feature is not enabled."
                        );
                    }
                    "flex" => {
                        #[cfg(any(feature = "flex", default_backend))]
                        return Self::Flex(FlexDevice);
                        panic!(
                            "BURN_DEVICE=flex requested, but the 'flex' feature is not enabled."

View on GitHub (pinned to d16f7ba2ed)

Solutions

  1. Enable the `cpu` feature and rebuild.
  2. Select a different enabled backend with BURN_DEVICE.
  3. Unset BURN_DEVICE to fall back to the compiled default.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at crates/burn-dispatch/src/device.rs:261 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of tracel-ai/burn@d16f7ba2ed (2026-09-05). Data as JSON: /api/errors/878c2bd811fbc39d. Report an issue: GitHub.