{"record":{"id":"cc945a35b6868301","repo":"tracel-ai/burn","slug":"unsupported-dispatch-device-other","errorCode":null,"errorMessage":"unsupported dispatch device: {__other:?}","messagePattern":"unsupported dispatch device: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-backend-extension/src/dispatch.rs","lineNumber":345,"sourceCode":"    body: &syn::Block,\n) -> TokenStream {\n    let direct_arms = BACKENDS\n        .iter()\n        .map(|backend| creation_arm(backend, output, body, false));\n    let autodiff_arms = BACKENDS\n        .iter()\n        .map(|backend| creation_arm(backend, output, body, true));\n    quote! {\n        match #device {\n            #(#direct_arms)*\n            #[cfg(feature = \"autodiff\")]\n            crate::DispatchDevice::Autodiff(__device) => match __device.inner.as_ref() {\n                #(#autodiff_arms)*\n                crate::DispatchDevice::Autodiff(_) => {\n                    panic!(\"Autodiff should not wrap an autodiff device.\")\n                }\n                #[allow(unreachable_patterns)]\n                __other => panic!(\"unsupported dispatch device: {__other:?}\"),\n            },\n            #[allow(unreachable_patterns)]\n            __other => panic!(\"unsupported dispatch device: {__other:?}\"),\n        }\n    }\n}\n\nfn creation_arm(\n    backend: &crate::BackendSpec,\n    output: &OperationOutput,\n    body: &syn::Block,\n    autodiff_device: bool,\n) -> TokenStream {\n    let ident = syn::Ident::new(backend.name, proc_macro2::Span::call_site());\n    let cfg: TokenStream = backend.cfg.parse().expect(\"valid backend cfg\");\n    if !autodiff_device {\n        let wrapped = routing::wrap_output(\n            output,","sourceCodeStart":327,"sourceCodeEnd":363,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-backend-extension/src/dispatch.rs#L327-L363","documentation":"Generated by expand_creation as the inner fallback arm: when the macro unwraps DispatchDevice::Autodiff and its inner device matches no known backend (and is not a nested Autodiff), it panics with the unsupported device. This is a catch-all for an inner device the macro generated arms for — meaning a backend feature is not compiled in or the enum gained an unknown variant.","triggerScenarios":"Creating a tensor/operation with an Autodiff device whose inner device belongs to a backend whose cfg feature flag is disabled at compile time, or an otherwise unknown inner DispatchDevice variant.","commonSituations":"Enabling feature = \"autodiff\" but not the backend feature the inner device targets; mixing crates compiled with different backend feature sets; version mismatch after a new DispatchDevice variant was added.","solutions":["Enable the cargo feature for the inner backend (e.g. the backend-specific feature in burn-backend-extension) so the corresponding cfg-gated arm is generated","Inspect the printed device in the panic to identify which backend variant is missing","Align feature flags across all crates in the workspace so every consumer compiles with the same backends","Update to matching versions of the dispatch crates if a new device variant exists"],"exampleFix":"// before (Cargo.toml)\n[features]\ndefault = [\"autodiff\"]\n// after\n[features]\ndefault = [\"autodiff\", \"backend-cpu\"]  # ensure the inner backend feature is on","handlingStrategy":"validation","validationCode":"fn supports_inner(device: &DispatchDevice) -> bool {\n    match device {\n        DispatchDevice::Autodiff(inner) => !matches!(\n            inner.inner.as_ref(),\n            DispatchDevice::Cpu(_) if !cfg!(feature = \"backend-cpu\")\n        ) && !matches!(inner.inner.as_ref(), DispatchDevice::Autodiff(_)),\n        _ => true,\n    }\n}","typeGuard":"fn is_autodiff_device(d: &DispatchDevice) -> Option<&AutodiffDevice> {\n    match d { DispatchDevice::Autodiff(inner) => Some(inner), _ => None }\n}","tryCatchPattern":"let result = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| op(&device)));\nmatch result {\n    Ok(v) => v,\n    Err(_) => eprintln!(\"dispatch device unsupported; check backend features\"),\n}","preventionTips":["Keep autodiff and its target backend features enabled together in Cargo.toml","Verify the inner device of an Autodiff device is a compiled-in backend before dispatch","Synchronize feature flags across workspace crates"],"tags":["rust","proc-macro","feature-flags","device-dispatch"],"backgroundTag":"unsupported-dispatch-device","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"}