{"record":{"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":"exception","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/6e10b029c1326a437932a8b24f38af69fd986e15/boto3/s3/transfer.py#L399-L435","documentation":"Raised by the `S3Transfer` constructor when a `manager` (a pre-built `TransferManager`) is passed alongside any of `client`, `config`, or `osutil`. These are mutually exclusive: when you supply your own manager, boto3 must not override its internal client/config/osutil. Pick one mode — delegate construction (pass `client`) or bring your own manager.","triggerScenarios":"Calling `S3Transfer(client=s3_client, config=cfg, osutil=OSUtils(), manager=my_manager)` (any combination where `manager` and at least one of the others are non-None). Often a partial refactor that added a manager while leaving the old arguments in place.","commonSituations":"Migrating from client-based construction to a custom manager and forgetting to remove the now-redundant `client=`/`config=` kwargs; copy-pasting a custom TransferManager example onto existing S3Transfer code.","solutions":["If you only need custom config, drop `manager` and pass `client` + `config`: `S3Transfer(client=s3, config=cfg)`.","If you built a fully custom manager, drop `client`, `config`, and `osutil`: `S3Transfer(manager=my_manager)`.","Audit the call site and pass arguments from only one of the two groups."],"exampleFix":"# before\nfrom boto3.s3.transfer import S3Transfer, TransferConfig\ntransfer = S3Transfer(client=s3, config=TransferConfig(), manager=mgr)\n\n# after (delegate mode)\ntransfer = S3Transfer(client=s3, config=TransferConfig())\n# after (custom-manager mode)\ntransfer = S3Transfer(manager=mgr)","handlingStrategy":"validation","validationCode":"def build_transfer(client=None, config=None, osutil=None, manager=None):\n    if manager:\n        assert not any([client, config, osutil]), 'manager is mutually exclusive with client/config/osutil'\n    else:\n        assert client, 'client required when manager is absent'\n    from boto3.s3.transfer import S3Transfer\n    return S3Transfer(client=client, config=config, osutil=osutil, manager=manager)","typeGuard":"def manager_only_kwargs(client, config, osutil, manager) -> bool:\n    return bool(manager) and not any([client, config, osutil])","tryCatchPattern":"try:\n    t = S3Transfer(client=s3, config=cfg, manager=mgr)\nexcept ValueError:\n    t = S3Transfer(client=s3, config=cfg)  # drop the manager","preventionTips":["Decide upfront: delegate (client+config) or bring-your-own (manager).","When refactoring to a custom manager, delete the old kwargs in the same commit.","Document the mutual-exclusion at call sites that build S3Transfer."],"tags":["s3","transfer","constructor","argument-validation","mutually-exclusive"],"backgroundTag":null,"analyzedSha":"6e10b029c1326a437932a8b24f38af69fd986e15","analyzedAt":"2026-08-11T20:52:47.213Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}