{"record":{"id":"cdb4c91e42bd8a28","repo":"tracel-ai/burn","slug":"unsupported-dispatch-backend","errorCode":null,"errorMessage":"unsupported dispatch backend","messagePattern":"unsupported dispatch backend","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-backend-extension/src/dispatch.rs","lineNumber":199,"sourceCode":") -> TokenStream {\n    let float_inputs = float_input_presence(operation, source);\n    let backends = dispatch_backends();\n    let source_is_non_float = source.is_some_and(|source| {\n        matches!(\n            source.kind,\n            InputKind::Tensor { kind, .. } if kind != TensorKind::Float\n        )\n    });\n    let paths = routing::RoutingPaths::dispatch();\n    let selected =\n        source.map(|_| syn::Ident::new(\"__burn_selected\", proc_macro2::Span::call_site()));\n    let autodiff_match = (!source_is_non_float).then(|| routing::AutodiffKindMatch {\n        cfg_attr: Some(quote!(#[cfg(feature = \"autodiff\")])),\n        inner_kind,\n        nested_autodiff: Some(quote! {\n            panic!(\"Autodiff should not wrap an autodiff tensor.\")\n        }),\n        fallback: quote!(panic!(\"unsupported dispatch backend\")),\n    });\n    let arms = routing::backend_kind_arms(\n        &paths,\n        &backends,\n        selected.as_ref(),\n        autodiff_match,\n        |_, backend, autodiff| {\n            backend_route_body(backend, operation, &float_inputs, autodiff, source)\n        },\n    );\n    let direct_arms = arms.concrete;\n    let autodiff_route = if source_is_non_float {\n        quote! {\n            #[cfg(feature = \"autodiff\")]\n            crate::DispatchTensorKind::Autodiff(_) => {\n                panic!(\"only float tensors may use an autodiff primitive\")\n            }\n        }","sourceCodeStart":181,"sourceCodeEnd":217,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-backend-extension/src/dispatch.rs#L181-L217","documentation":"Generated by the dispatch macro's generated match: when the tensor kind's backend does not correspond to any registered backend arm (the autodiff route's fallback), the code panics with 'unsupported dispatch backend'. It means the runtime backend kind found in the DispatchTensor has no matching arm in the macro-expanded match.","triggerScenarios":"Calling a macro-generated dispatch function with a tensor whose backend was not listed in the macro invocation's backend list; feature-flag mismatches (autodiff enabled but no concrete backend arm compiled in) so the fallback arm executes.","commonSituations":"Adding a new backend to the project but forgetting to register it in the dispatch macro call; building with a feature set where the expected backend arm is cfg'd out; mixing tensors from two different compiled backends at runtime.","solutions":["Register the backend you use in the dispatch macro's backend list","Enable the cargo feature that activates the matching backend arm so the tensor matches a concrete arm","Unwrap/convert the tensor to a registered backend before dispatching","Update burn-backend-extension version if a backend arm was added upstream"],"exampleFix":"// before\nexpand_backend_dispatch! { backends: [Wgpu] }\n// tensor uses burn_tch::Tch — panic\n// after\nexpand_backend_dispatch! { backends: [Wgpu, Tch] }","handlingStrategy":"validation","validationCode":"// Before dispatch, confirm the tensor's backend is registered\n// compile-time: list every backend you use in the macro invocation\nexpand_backend_dispatch! { backends: [Wgpu, Tch] }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep the backend list in the dispatch macro in sync with the backends actually used","Match cargo features across crates sharing dispatch tensors","Convert/copy tensors to a registered backend before dispatching"],"tags":["rust","dispatch-macro","backend-mismatch"],"backgroundTag":"unsupported-dispatch-backend","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"}