{"id":"21650a2d622ee887","repo":"boto/boto3","slug":"manager-cannot-be-provided-with-client-config-no","errorCode":null,"errorMessage":"Manager cannot be provided with client, config, nor osutil. These parameters are mutually exclusive.","messagePattern":"Manager cannot be provided with client, config, nor osutil\\. These parameters are mutually exclusive\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"boto3/s3/transfer.py","lineNumber":417,"sourceCode":"                resolved[init_arg] = self.UNSET_DEFAULT\n            else:\n                resolved[init_arg] = self.DEFAULTS[init_arg]\n        return resolved\n\n\nclass S3Transfer:\n    ALLOWED_DOWNLOAD_ARGS = TransferManager.ALLOWED_DOWNLOAD_ARGS\n    ALLOWED_UPLOAD_ARGS = TransferManager.ALLOWED_UPLOAD_ARGS\n    ALLOWED_COPY_ARGS = TransferManager.ALLOWED_COPY_ARGS\n\n    def __init__(self, client=None, config=None, osutil=None, manager=None):\n        if not client and not manager:\n            raise ValueError(\n                'Either a boto3.Client or s3transfer.manager.TransferManager '\n                'must be provided'\n            )\n        if manager and any([client, config, osutil]):\n            raise ValueError(\n                'Manager cannot be provided with client, config, '\n                'nor osutil. These parameters are mutually exclusive.'\n            )\n        if config is None:\n            config = TransferConfig()\n        if osutil is None:\n            osutil = OSUtils()\n        if manager:\n            self._manager = manager\n        else:\n            self._manager = create_transfer_manager(client, config, osutil)\n\n    def upload_file(\n        self, filename, bucket, key, callback=None, extra_args=None\n    ):\n        \"\"\"Upload a file to an S3 object.\n\n        Variants have also been injected into S3 client, Bucket and Object.","sourceCodeStart":399,"sourceCodeEnd":435,"githubUrl":"https://github.com/boto/boto3/blob/c7b4afac237b976d48395d7523eaf7cec3a450b3/boto3/s3/transfer.py#L399-L435","documentation":"Raised by S3Transfer.__init__ when a caller supplies manager= together with any of client=, config=, or osutil=. When you hand in a fully-built TransferManager it already encapsulates its own client/config/osutil, so providing those separately would be ambiguous and ignored; boto3 treats them as mutually exclusive and rejects the combination with this ValueError.","triggerScenarios":"Constructing S3Transfer(client=..., manager=...), S3Transfer(config=..., manager=...), S3Transfer(osutil=..., manager=...), or any combination that includes manager plus one of the others.","commonSituations":"Migrating code that previously passed a client and then adding a pre-built manager without removing the other arguments; copy-pasting examples that mix the two construction styles.","solutions":["Choose one construction style: either pass only manager= (a complete TransferManager), or pass client= (+ optional config=/osutil=) and let S3Transfer build the manager.","If you built the manager from a specific client/config, do not also pass those to S3Transfer; the manager already carries them.","Switch to the injected s3.upload_file/download_file helpers to avoid managing S3Transfer construction entirely."],"exampleFix":"// before\nmgr = TransferManager(client, config, osutil)\ntransfer = S3Transfer(client=client, config=config, manager=mgr)  # mutually exclusive\n\n// after\nmgr = TransferManager(client, config, osutil)\ntransfer = S3Transfer(manager=mgr)","handlingStrategy":"validation","validationCode":"if manager is not None and (client is not None or config is not None or osutil is not None):\n    raise ValueError('manager is mutually exclusive with client/config/osutil')","typeGuard":"def transfer_args_consistent(client, config, osutil, manager) -> bool:\n    return manager is None or (client is None and config is None and osutil is None)","tryCatchPattern":"try:\n    transfer = boto3.s3.transfer.S3Transfer(client=client, manager=manager)\nexcept ValueError as e:\n    if 'mutually exclusive' in str(e):\n        transfer = boto3.s3.transfer.S3Transfer(manager=manager)  # drop client/config","preventionTips":["Use either the client-style or the manager-style construction, never both.","When introducing a pre-built manager, remove any previously-passed client/config/osutil.","Prefer the injected s3.upload_file helpers to avoid S3Transfer construction entirely."],"tags":["boto3","s3","transfer","validation","api-misuse"],"analyzedSha":"c7b4afac237b976d48395d7523eaf7cec3a450b3","analyzedAt":"2026-08-04T20:35:51.598Z","schemaVersion":2}