{"record":{"id":"dafb594242595eee","repo":"tracel-ai/burn","slug":"unknown-burn-device-override","errorCode":null,"errorMessage":"Unknown BURN_DEVICE override: '{}'.","messagePattern":"Unknown BURN_DEVICE override: '(.+?)'\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"crates/burn-dispatch/src/device.rs","lineNumber":289,"sourceCode":"                        panic!(\n                            \"BURN_DEVICE=remote requested, but the 'remote' feature is not enabled.\"\n                        );\n                    }\n                    \"flex\" => {\n                        #[cfg(any(feature = \"flex\", default_backend))]\n                        return Self::Flex(FlexDevice);\n                        panic!(\n                            \"BURN_DEVICE=flex requested, but the 'flex' feature is not enabled.\"\n                        );\n                    }\n                    \"ndarray\" => {\n                        #[cfg(feature = \"ndarray\")]\n                        return Self::NdArray(NdArrayDevice::default());\n                        panic!(\n                            \"BURN_DEVICE=ndarray requested, but the 'ndarray' feature is not enabled.\"\n                        );\n                    }\n                    _ => panic!(\"Unknown BURN_DEVICE override: '{}'.\", device_str),\n                }\n            }\n        }\n\n        // Spelled out per feature rather than left to `CubeDevice::default()`: that answers for\n        // the runtimes *cubecl* compiled in, and cargo unifies features across a build, so a\n        // workspace that also builds `burn-cuda` would hand this crate a CUDA default even when\n        // it was built with only `wgpu`. The order is the one a caller who did not choose would\n        // want — a discrete accelerator, then the portable path, then the CPU.\n        #[cfg(feature = \"cuda\")]\n        return Self::Cube(CubeDevice::Cuda(Default::default()));\n\n        #[cfg(feature = \"metal\")]\n        return Self::Cube(CubeDevice::Wgpu(Default::default()));\n\n        #[cfg(feature = \"rocm\")]\n        return Self::Cube(CubeDevice::Hip(Default::default()));\n","sourceCodeStart":271,"sourceCodeEnd":307,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-dispatch/src/device.rs#L271-L307","documentation":"The BURN_DEVICE environment variable contained a value that matches no known backend arm in the dispatcher's match statement. Burn validates the override string against its list of compiled backends and panics on any unrecognized name rather than guessing or falling back to the default device.","triggerScenarios":"Exporting BURN_DEVICE with a typo or unsupported value (e.g. BURN_DEVICE=cuda, BURN_DEVICE=gpu, BURN_DEVICE=Candle, BURN_DEVICE=tch) where the expected arm names are exact lowercase backend identifiers like candle, ndarray, flex, remote, or cubecl runtime names; hit in device.rs:289's `_ =>` arm.","commonSituations":"Typos in deployment scripts or Makefiles; using names from Burn's older APIs or other frameworks (e.g. 'cuda', 'cpu'); copying env config between projects that expose different backend names.","solutions":["Set BURN_DEVICE to an exact supported identifier (check the match arms in crates/burn-dispatch/src/device.rs, e.g. candle, ndarray, flex, remote, or a cubecl runtime like wgpu/cuda).","Fix case sensitivity and whitespace: the value must be lowercase and trimmed (BURN_DEVICE=GPU is invalid).","Remove BURN_DEVICE entirely to use the default device resolution when no override is needed.","Grep your deployment/CI config for `BURN_DEVICE=` and validate every value against the enabled feature set."],"exampleFix":"// before (deploy.sh)\nexport BURN_DEVICE=cuda   # unknown name -> panic\n\n// after\nexport BURN_DEVICE=cudacompile   # or the exact runtime name, e.g.:\nexport BURN_DEVICE=candle","handlingStrategy":"validation","validationCode":"const VALID: &[&str] = &[\"candle\", \"ndarray\", \"flex\", \"remote\", \"wgpu\", \"cuda\", \"rocm\", \"vulkan\", \"metal\"];\nif let Ok(d) = std::env::var(\"BURN_DEVICE\") {\n    if !VALID.contains(&d.as_str()) {\n        panic!(\"BURN_DEVICE='{}' is not a known backend name\", d);\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate env var values in deployment scripts with set -e and an explicit allowlist.","Copy backend names only from the dispatcher's match arms, never from memory or other frameworks.","Omit BURN_DEVICE entirely when the default device is acceptable."],"tags":["rust","environment-variable","configuration","typo","burn"],"backgroundTag":"invalid-env-var-value","analyzedSha":"d16f7ba2ed0d41408189384044cc886fb4c8f957","analyzedAt":"2026-09-05T13:19:14.260Z","contentChangedAt":"2026-09-05T13:19:14.260Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}