{"record":{"id":"79248209a3ddbf9c","repo":"Lightning-AI/pytorch-lightning","slug":"the-xla-strategy-can-only-work-with-the-xlacheckp-792482","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/xla.py","lineNumber":86,"sourceCode":"        )\n        self.debug = debug\n        self._launched = False\n        self._sync_module_states = sync_module_states\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":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/Lightning-AI/pytorch-lightning/blob/9fed5c27d2a62ff0efd6c3573599921d6ff67c14/src/lightning/pytorch/strategies/xla.py#L68-L104","documentation":"Identical validation to single_xla: XLAStrategy's checkpoint_io setter only accepts XLACheckpointIO or _WrappingCheckpointIO; any other CheckpointIO is rejected with TypeError because XLA checkpoint save/load requires xm/xla-specific handling.","triggerScenarios":"strategy.checkpoint_io = <custom or torch CheckpointIO> or XLAStrategy(checkpoint_io=...) with an incompatible plugin on the multi-device XLA strategy.","commonSituations":"Reusing checkpoint plugin configuration from DDP/DeepSpeed setups; S3/GCS checkpointing plugins not wrapped for XLA.","solutions":["Use XLACheckpointIO or _WrappingCheckpointIO(your_io)","Subclass XLACheckpointIO for custom behavior","Pass storage credentials via environment instead of a custom IO"],"exampleFix":"# before\nstrategy = XLAStrategy(checkpoint_io=MyS3CheckpointIO())\n\n# after\nfrom lightning.pytorch.plugins.io.xla import XLACheckpointIO\nfrom lightning.pytorch.strategies.xla import _WrappingCheckpointIO\nstrategy = XLAStrategy(checkpoint_io=_WrappingCheckpointIO(MyS3CheckpointIO()))","handlingStrategy":"type-guard","validationCode":"assert io is None or isinstance(io, (XLACheckpointIO, _WrappingCheckpointIO)), \"wrap custom IO with _WrappingCheckpointIO\"","typeGuard":"def is_valid_xla_checkpoint_io(io) -> bool:\n    return io is None or type(io).__name__ in {\"XLACheckpointIO\", \"_WrappingCheckpointIO\"} or isinstance(io, (XLACheckpointIO, _WrappingCheckpointIO))","tryCatchPattern":null,"preventionTips":["Use _WrappingCheckpointIO for custom storage backends on XLA","Keep per-accelerator strategy config dicts rather than one shared config"],"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"}