{"record":{"id":"4a563c7fafcefbf7","repo":"xai-org/x-algorithm","slug":"execution-devices-belong-to-a-client-other-than-b","errorCode":null,"errorMessage":"Execution devices belong to a client other than `backend`. Got backend client: {(backend.platform, backend.platform_version)} and execution devices client: {(device_backend.platform, device_backend.platform_version)}","messagePattern":"Execution devices belong to a client other than `backend`\\. Got backend client: (.+?) and execution devices client: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"phoenix/xrex/utils/aot.py","lineNumber":252,"sourceCode":"        if isinstance(obj, xc.CompileOptions):\n            return (\"compile_options\", obj.SerializeAsString())\n        return None\n\n\nclass _JaxPjrtUnpickler(pickle.Unpickler):\n    def __init__(\n        self,\n        file,\n        backend: xc.Client,\n        execution_devices: Sequence[xc.Device],\n        host_callbacks: Any,\n        compile_options: xc.CompileOptions | None,\n    ):\n        super().__init__(file)\n        self.backend = backend\n        device_backend = execution_devices[0].client\n        if device_backend != backend:\n            raise ValueError(\n                \"Execution devices belong to a client other than `backend`. Got \"\n                f\"backend client: {(backend.platform, backend.platform_version)} \"\n                \"and execution devices client: \"\n                f\"{(device_backend.platform, device_backend.platform_version)}\"\n            )\n        self.execution_devices = xc.DeviceList(tuple(execution_devices))\n        self.host_callbacks = host_callbacks\n        self.compile_options = compile_options\n\n    def persistent_load(self, pid):\n        if pid[0] == \"exec\":\n            compile_options = self.compile_options\n            if self.host_callbacks:\n                return self.backend.deserialize_executable(\n                    pid[1],\n                    executable_devices=self.execution_devices,\n                    compile_options=compile_options,\n                    host_callbacks=self.host_callbacks,","sourceCodeStart":234,"sourceCodeEnd":270,"githubUrl":"https://github.com/xai-org/x-algorithm/blob/24c60942c5c5fdad3a6addffb4c6e6d2f228f04f/phoenix/xrex/utils/aot.py#L234-L270","documentation":"The pickler checks that the first execution device's client (backend) equals the backend passed in, because serialized device references are only valid within one PJRT client. Devices obtained from a different jax Backend (e.g. a CPU backend vs GPU backend, or a second client created manually) trigger this error, with both platforms printed for diagnosis.","triggerScenarios":"Constructing the pickler with backend = jax.backend_by_platform('cpu') but devices from jax.devices() on GPU; creating multiple backends/clients (common with jax.extend or custom PJRT initialization) and mixing them.","commonSituations":"Multi-backend setups (CPU host backend + GPU compute backend); plugin runtimes where a separate client is created; refactors that cache a backend across processes.","solutions":["Derive both backend and devices from the same source: backend = jax.devices()[0].client and execution_devices = jax.devices()","Do not create extra Backends/clients; use the process-default jax backend","Compare the printed platform tuples to spot which backend is mismatched"],"exampleFix":"# before\nbackend = jax.backend_by_platform('cpu')\ndevices = jax.devices()  # gpu devices\n# after\nbackend = jax.devices()[0].client\ndevices = jax.devices()","handlingStrategy":"validation","validationCode":"devices = jax.devices()\nbackend = devices[0].client\nassert devices[0].client == backend","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Derive backend from jax.devices()[0].client, never a separately constructed backend","Avoid multi-client initialization in single-process jobs","Log (backend.platform, devices[0].client.platform) at startup as a sanity check"],"tags":["jax","backend","device-mismatch","serialization"],"backgroundTag":"backend-client-mismatch","analyzedSha":"24c60942c5c5fdad3a6addffb4c6e6d2f228f04f","analyzedAt":"2026-08-28T11:40:14.686Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}