{"record":{"id":"662209ede2b930be","repo":"Lightning-AI/pytorch-lightning","slug":"received-both-precision-precision-input-and-p","errorCode":null,"errorMessage":"Received both `precision={precision_input}` and `plugins={self._precision_instance}`. Choose one.","messagePattern":"Received both `precision=(.+?)` and `plugins=(.+?)`\\. Choose one\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/lightning/fabric/connector.py","lineNumber":253,"sourceCode":"                    plugins_flags_types[CheckpointIO.__name__] += 1\n                elif isinstance(plugin, ClusterEnvironment):\n                    self._cluster_environment_flag = plugin\n                    plugins_flags_types[ClusterEnvironment.__name__] += 1\n                else:\n                    raise TypeError(\n                        f\"Found invalid type for plugin {plugin}. Expected one of: Precision, \"\n                        \"CheckpointIO, ClusterEnvironment.\"\n                    )\n\n            duplicated_plugin_key = [k for k, v in plugins_flags_types.items() if v > 1]\n            if duplicated_plugin_key:\n                raise ValueError(\n                    f\"Received multiple values for {', '.join(duplicated_plugin_key)} flags in `plugins`.\"\n                    \" Expected one value for each type at most.\"\n                )\n\n            if plugins_flags_types.get(Precision.__name__) and precision_input is not None:\n                raise ValueError(\n                    f\"Received both `precision={precision_input}` and `plugins={self._precision_instance}`. Choose one.\"\n                )\n\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","sourceCodeStart":235,"sourceCodeEnd":271,"githubUrl":"https://github.com/Lightning-AI/pytorch-lightning/blob/9fed5c27d2a62ff0efd6c3573599921d6ff67c14/src/lightning/fabric/connector.py#L235-L271","documentation":"Fabric rejects setting precision through two channels at once. If a Precision plugin is supplied via `plugins` AND a `precision=` string argument is also given, the connector cannot decide which wins and raises this error.","triggerScenarios":"Fabric(precision=\"16-mixed\", plugins=[MixedPrecision(\"16-mixed\")]) or Fabric(precision=\"bf16-true\", plugins=[DeepSpeedPrecision(...)]) — any non-None `precision` combined with a plugins entry that registers under Precision.__name__.","commonSituations":"Adding a DeepSpeed or MixedPrecision plugin to an existing Fabric(precision=\"...\") call without removing the precision flag; porting Trainer code where both were tolerated; copy-pasting plugin setup on top of an old config.","solutions":["Remove the `precision=` argument and let the Precision plugin define precision","Or remove the Precision plugin from `plugins` and keep only `precision=\"...\"`"],"exampleFix":"# before\nfabric = Fabric(precision=\"16-mixed\", plugins=[MixedPrecision(\"16-mixed\")])\n\n# after\nfabric = Fabric(plugins=[MixedPrecision(\"16-mixed\")])","handlingStrategy":"validation","validationCode":"from lightning.fabric.plugins import Precision\n\nhas_precision_plugin = any(isinstance(p, Precision) for p in plugins)\nif has_precision_plugin and precision is not None:\n    raise SystemExit(\"Set either precision= or a Precision plugin, not both\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat precision= and Precision plugins as mutually exclusive in config schemas","When adding DeepSpeed/MixedPrecision plugins, strip the precision key from the config"],"tags":["lightning","fabric","precision","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"}