{"record":{"id":"17ea1d6e2124865b","repo":"Lightning-AI/pytorch-lightning","slug":"checkpoint-io-set-through-both-strategy-class-and","errorCode":null,"errorMessage":"checkpoint_io set through both strategy class and plugins, choose one","messagePattern":"checkpoint_io set through both strategy class and plugins, choose one","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/lightning/fabric/connector.py","lineNumber":274,"sourceCode":"\n        self._precision_input = \"32-true\" if precision_input is None else precision_input\n\n        # handle the case when the user passes in a strategy instance which has an accelerator, precision,\n        # checkpoint io or cluster env set up\n        # TODO: improve the error messages below\n        if isinstance(self._strategy_flag, Strategy):\n            if self._strategy_flag._accelerator:\n                if self._accelerator_flag != \"auto\":\n                    raise ValueError(\"accelerator set through both strategy class and accelerator flag, choose one\")\n                self._accelerator_flag = self._strategy_flag._accelerator\n            if self._strategy_flag._precision:\n                # [RFC] handle precision plugin set up conflict?\n                if self._precision_instance:\n                    raise ValueError(\"precision set through both strategy class and plugins, choose one\")\n                self._precision_instance = self._strategy_flag._precision\n            if self._strategy_flag._checkpoint_io:\n                if self.checkpoint_io:\n                    raise ValueError(\"checkpoint_io set through both strategy class and plugins, choose one\")\n                self.checkpoint_io = self._strategy_flag._checkpoint_io\n            if getattr(self._strategy_flag, \"cluster_environment\", None):\n                if self._cluster_environment_flag:\n                    raise ValueError(\"cluster_environment set through both strategy class and plugins, choose one\")\n                self._cluster_environment_flag = getattr(self._strategy_flag, \"cluster_environment\")\n\n            if hasattr(self._strategy_flag, \"parallel_devices\") and self._strategy_flag.parallel_devices:\n                if self._strategy_flag.parallel_devices[0].type == \"cpu\":\n                    if self._accelerator_flag and self._accelerator_flag not in (\"auto\", \"cpu\"):\n                        raise ValueError(\n                            f\"CPU parallel_devices set through {self._strategy_flag.__class__.__name__} class,\"\n                            f\" but accelerator set to {self._accelerator_flag}, please choose one device type\"\n                        )\n                    self._accelerator_flag = \"cpu\"\n                if self._strategy_flag.parallel_devices[0].type == \"cuda\":\n                    if self._accelerator_flag and self._accelerator_flag not in (\"auto\", \"cuda\", \"gpu\"):\n                        raise ValueError(\n                            f\"GPU parallel_devices set through {self._strategy_flag.__class__.__name__} class,\"","sourceCodeStart":256,"sourceCodeEnd":292,"githubUrl":"https://github.com/Lightning-AI/pytorch-lightning/blob/9fed5c27d2a62ff0efd6c3573599921d6ff67c14/src/lightning/fabric/connector.py#L256-L292","documentation":"A Strategy instance passed to Fabric already contains a checkpoint_io (`_checkpoint_io` set), but a CheckpointIO plugin was also provided via `plugins` (which populated self.checkpoint_io). Only one checkpoint IO implementation can be active.","triggerScenarios":"strategy = DDPStrategy(checkpoint_io=FileSystemCheckpointIO(...)); Fabric(strategy=strategy, plugins=[FileSystemCheckpointIO(...)]) — or any CheckpointIO plugin combined with a strategy carrying _checkpoint_io.","commonSituations":"Using DeepSpeedStrategy (which sets its own checkpoint IO) together with a custom CheckpointIO plugin; adding async checkpointing plugins on top of preconfigured strategies; sharing strategy objects from distributed launch scripts.","solutions":["Remove the CheckpointIO entry from `plugins` and rely on the strategy's checkpoint_io","Or build the Strategy without checkpoint_io and pass the CheckpointIO plugin via `plugins`"],"exampleFix":"# before\nstrategy = DDPStrategy(checkpoint_io=FileSystemCheckpointIO())\nfabric = Fabric(strategy=strategy, plugins=[FileSystemCheckpointIO()])\n\n# after\nstrategy = DDPStrategy()\nfabric = Fabric(strategy=strategy, plugins=[FileSystemCheckpointIO()])","handlingStrategy":"validation","validationCode":"from lightning.fabric.plugins import CheckpointIO\n\nif isinstance(strategy, Strategy) and strategy._checkpoint_io and any(isinstance(p, CheckpointIO) for p in plugins):\n    raise SystemExit(\"CheckpointIO defined both in strategy and plugins; keep one\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Be aware DeepSpeedStrategy sets its own checkpoint IO","Pass CheckpointIO either through the strategy or plugins, never both"],"tags":["lightning","fabric","strategy","checkpointio","plugins","conflicting-arguments"],"backgroundTag":"conflicting-config-arguments","analyzedSha":"9fed5c27d2a62ff0efd6c3573599921d6ff67c14","analyzedAt":"2026-08-28T11:52:41.083Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}