{"record":{"id":"0f1496b8824c5701","repo":"tracel-ai/burn","slug":"distributed-operations-are-not-supported-for-devic","errorCode":null,"errorMessage":"Distributed operations are not supported for device {other:?}","messagePattern":"Distributed operations are not supported for device (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-dispatch/src/macros.rs","lineNumber":74,"sourceCode":"            #[cfg(feature = \"autodiff\")]\n            $crate::DispatchDevice::Autodiff(inner) => {\n                // Recursively dispatch on inner\n                dispatch_device_arms!(\n                    @autodiff\n                    &**inner,\n                    |$inner| $body;\n                    $([$Backend, $cfg]),*\n                )\n            },\n            $(\n                #[cfg($cfg)]\n                $crate::DispatchDevice::$Backend($inner) => {\n                    type B = $crate::backends::$Backend;\n                    $body\n                }\n            )*\n            #[allow(unreachable_patterns)]\n            other => panic!(\"Distributed operations are not supported for device {other:?}\"),\n        }\n    };\n    (\n        @autodiff\n        $device:expr,\n        |$inner:ident| $body:expr;\n        $([$Backend:ident, $cfg:meta]),*\n    ) => {\n        match $device {\n            $(\n                #[cfg($cfg)]\n                $crate::DispatchDevice::$Backend($inner) => {\n                    type B = $crate::backends::Autodiff<$crate::backends::$Backend>;\n                    $body\n                }\n            )*\n            $crate::DispatchDevice::Autodiff(_) => unreachable!(\"Autodiff should not wrap an autodiff device.\"),\n            #[allow(unreachable_patterns)]","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-dispatch/src/macros.rs#L56-L92","documentation":"A distributed-operation macro in burn-dispatch matched a DispatchDevice variant it cannot handle — the catch-all `other` arm panics with 'Distributed operations are not supported for device {other:?}'. The macro is generated per concrete backend, and any device type outside the enumerated backends (e.g. a distributed/multi-node device variant) reaches the fallback arm. This is a compile-time-generated dispatch, so the panic means the operation was invoked on a device kind the backend macro set does not cover.","triggerScenarios":"Invoking a distributed operation (via the macro at macros.rs:74) while the active DispatchDevice is a variant not enumerated by the macro's backend list — e.g. a distributed device struct passed where a single-backend device is expected. The 'USED AT' call sites (CheckpointerBuilder::extend/infer in burn-autodiff) show the generated code flowing through checkpoint builder construction on autodiff-wrapped devices.","commonSituations":"Mixing single-node backends with distributed training setups; enabling distributed features but running on a device that resolves to a non-backend variant; library code (like the autodiff checkpointer) being generic over devices while the macro only supports concrete backends.","solutions":["Run distributed operations on a device variant that the dispatch macro supports (one of the enumerated backends), not on a distributed/custom DispatchDevice variant.","Check how the device was constructed — a DispatchDevice::Distributed or similar must not reach single-backend operation macros; convert or extract the inner backend device first.","If writing generic code, match the device and route distributed variants to a distributed-aware API before invoking backend macros.","Update burn if you believe the variant should be supported — the macro arm list grows per release."],"exampleFix":"// before\ndevice.dispatch(distributed_op) // device = DispatchDevice::Distributed(..) -> panic\n\n// after\nmatch device {\n    DispatchDevice::Distributed(d) => distributed_runtime::run(d),\n    _ => device.dispatch(op),\n}","handlingStrategy":"type-guard","validationCode":"fn supports_distributed(device: &DispatchDevice) -> bool {\n    !matches!(device, DispatchDevice::Distributed(_) | DispatchDevice::Remote(_))\n}","typeGuard":"fn is_backend_device(d: &DispatchDevice) -> Option<&DispatchDevice> {\n    match d {\n        DispatchDevice::Candle(_) | DispatchDevice::NdArray(_) | DispatchDevice::Flex(_) => Some(d),\n        _ => None, // distributed/unhandled variants rejected before dispatch\n    }\n}","tryCatchPattern":"// panic is not catchable idiomatic Rust; guard instead\nassert!(matches!(device, DispatchDevice::Candle(_) | _), \"use a supported backend device\");","preventionTips":["Never pass distributed device variants into single-backend operation macros.","Centralize device handling in one match that routes distributed variants separately.","Keep dispatch macro usage in sync with the device variants your app can produce."],"tags":["rust","macro","distributed","device-dispatch","burn"],"backgroundTag":"unsupported-device-for-operation","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"}