{"record":{"id":"ff7766da554b1c47","repo":"Lightning-AI/pytorch-lightning","slug":"the-xla-strategy-can-only-work-with-the-xlacheckp-ff7766","errorCode":null,"errorMessage":"The XLA strategy can only work with the `XLACheckpointIO` plugin, found {io}","messagePattern":"The XLA strategy can only work with the `XLACheckpointIO` plugin, found (.+?)","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"src/lightning/pytorch/strategies/single_xla.py","lineNumber":72,"sourceCode":"            checkpoint_io=checkpoint_io,\n            precision_plugin=precision_plugin,\n        )\n        self.debug = debug\n\n    @property\n    @override\n    def checkpoint_io(self) -> Union[XLACheckpointIO, _WrappingCheckpointIO]:\n        plugin = self._checkpoint_io\n        if plugin is not None:\n            assert isinstance(plugin, (XLACheckpointIO, _WrappingCheckpointIO))\n            return plugin\n        return XLACheckpointIO()\n\n    @checkpoint_io.setter\n    @override\n    def checkpoint_io(self, io: Optional[CheckpointIO]) -> None:\n        if io is not None and not isinstance(io, (XLACheckpointIO, _WrappingCheckpointIO)):\n            raise TypeError(f\"The XLA strategy can only work with the `XLACheckpointIO` plugin, found {io}\")\n        self._checkpoint_io = io\n\n    @property\n    @override\n    def precision_plugin(self) -> XLAPrecision:\n        plugin = self._precision_plugin\n        if plugin is not None:\n            assert isinstance(plugin, XLAPrecision)\n            return plugin\n        return XLAPrecision()\n\n    @precision_plugin.setter\n    @override\n    def precision_plugin(self, precision_plugin: Optional[Precision]) -> None:\n        if precision_plugin is not None and not isinstance(precision_plugin, XLAPrecision):\n            raise TypeError(f\"The XLA strategy can only work with the `XLAPrecision` plugin, found {precision_plugin}\")\n        self._precision_plugin = precision_plugin\n","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/Lightning-AI/pytorch-lightning/blob/9fed5c27d2a62ff0efd6c3573599921d6ff67c14/src/lightning/pytorch/strategies/single_xla.py#L54-L90","documentation":"The XLA strategies delegate checkpointing to XLACheckpointIO (or a _WrappingCheckpointIO). The checkpoint_io setter validates this: assigning any other CheckpointIO implementation raises TypeError.","triggerScenarios":"Assigning strategy.checkpoint_io = TorchCheckpointIO() (or any custom CheckpointIO that is not XLACheckpointIO/_WrappingCheckpointIO) on SingleDeviceXLAStrategy/XLAStrategy; passing checkpoint_io=... to the strategy constructor with an incompatible plugin.","commonSituations":"Copy-pasting strategy configs from GPU setups that set a custom or cloud CheckpointIO; swapping plugins at runtime.","solutions":["Use XLACheckpointIO, or wrap your custom IO with _WrappingCheckpointIO so the XLA handling stays in place","Pass parallel_devices/other options instead of replacing checkpoint_io","If you need custom logic, subclass XLACheckpointIO"],"exampleFix":"# before\nstrategy = SingleDeviceXLAStrategy(checkpoint_io=TorchCheckpointIO())\n\n# after\nfrom lightning.pytorch.plugins.io.xla import XLACheckpointIO\nstrategy = SingleDeviceXLAStrategy(checkpoint_io=XLACheckpointIO())","handlingStrategy":"type-guard","validationCode":"from lightning.pytorch.plugins.io.xla import XLACheckpointIO\nassert io is None or isinstance(io, (XLACheckpointIO, _WrappingCheckpointIO))","typeGuard":"def is_valid_xla_checkpoint_io(io) -> bool:\n    from lightning.pytorch.plugins.io.xla import XLACheckpointIO\n    return io is None or isinstance(io, (XLACheckpointIO, _WrappingCheckpointIO))","tryCatchPattern":null,"preventionTips":["Don't share checkpoint_io configs between GPU and TPU strategy setups","Wrap custom IOs with _WrappingCheckpointIO or subclass XLACheckpointIO"],"tags":["xla","checkpoint-io","plugin-mismatch"],"backgroundTag":"plugin-type-mismatch","analyzedSha":"9fed5c27d2a62ff0efd6c3573599921d6ff67c14","analyzedAt":"2026-08-28T11:52:41.083Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}