{"record":{"id":"c82fb750becfb170","repo":"tracel-ai/burn","slug":"cannot-host-a-remote-server-on-a-remote-device","errorCode":null,"errorMessage":"Cannot host a remote server on a remote device","messagePattern":"Cannot host a remote server on a remote device","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-dispatch/src/remote_server.rs","lineNumber":101,"sourceCode":"            #[cfg(any(feature = \"flex\", default_backend))]\n            DispatchDevice::Flex(_) => {\n                type $b = Flex;\n                let $devices = host_devices!(DispatchDeviceId::Flex, Flex);\n                $body\n            }\n            #[cfg(feature = \"ndarray\")]\n            DispatchDevice::NdArray(_) => {\n                type $b = NdArray;\n                let $devices = host_devices!(DispatchDeviceId::NdArray, NdArray);\n                $body\n            }\n            #[cfg(feature = \"tch\")]\n            DispatchDevice::LibTorch(_) => {\n                panic!(\"LibTorch is not supported as a remote-server backend (no BackendIr impl)\")\n            }\n            #[cfg(feature = \"remote\")]\n            DispatchDevice::Remote(_) => {\n                panic!(\"Cannot host a remote server on a remote device\")\n            }\n            #[cfg(feature = \"capture\")]\n            DispatchDevice::Capture(_) => {\n                panic!(\"Cannot host a remote server on a capture device\")\n            }\n            #[cfg(feature = \"autodiff\")]\n            DispatchDevice::Autodiff(_) => {\n                unreachable!(\"Autodiff stripped by .inner() above\")\n            }\n        }\n    };\n}\n\n/// Start a remote-execution server for `device`'s backend, blocking the current thread.\n///\n/// `device` selects the backend; `channel` selects the transport. The server hosts that backend's\n/// devices, indexed by hardware device index. Use [`start_async`] for the async counterpart.\n#[cfg(not(target_family = \"wasm\"))]","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-dispatch/src/remote_server.rs#L83-L119","documentation":"This panic occurs when attempting to host a burn remote server on a device that is itself a Remote device. A remote server must execute ops on a real local backend (one with BackendIr); hosting on a remote device would create a server that forwards to another server, which is unsupported and would cause infinite forwarding.","triggerScenarios":"Starting a remote server with DispatchDevice::Remote(_) as the host device (feature \"remote\" enabled and the server's device resolved to a remote client device).","commonSituations":"Reusing a client-side configuration (pointing at a remote server) for the server binary; miswired device resolution where host_devices! picks up the client's remote device instead of a local one.","solutions":["Point the server's host device at a local backend device (e.g., DispatchDevice::NdArray).","Do not enable the `remote` device as the hosting device; remove remote device entries from the server config.","If nesting is needed, host the second server on a real backend and have clients choose which server to contact, rather than chaining servers."],"exampleFix":"// before (server config reusing client device)\nlet device = DispatchDevice::Remote(remote_client);\n// after\nlet device = DispatchDevice::NdArray(ndarray_device);","handlingStrategy":"validation","validationCode":"match device {\n    DispatchDevice::Remote(_) => return Err(\"cannot host a remote server on a remote device\".into()),\n    _ => {}\n}","typeGuard":"fn is_local_device(d: &DispatchDevice) -> bool {\n    !matches!(d, DispatchDevice::Remote(_))\n}","tryCatchPattern":null,"preventionTips":["Resolve the server's host device to a concrete local backend at startup.","Never reuse a client's remote device config for the server process.","Document that server chaining is unsupported in your deployment."],"tags":["rust","remote-server","dispatch","config"],"backgroundTag":"unsupported-backend-for-remote-server","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"}