{"record":{"id":"cdefff67d61fc913","repo":"crewAIInc/crewAI","slug":"boto3-is-required-for-bedrock-s3-file-uploads-ins","errorCode":null,"errorMessage":"boto3 is required for Bedrock S3 file uploads. Install with: pip install boto3","messagePattern":"boto3 is required for Bedrock S3 file uploads\\. Install with: pip install boto3","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"lib/crewai-files/src/crewai_files/uploaders/bedrock.py","lineNumber":167,"sourceCode":"                \"S3 bucket name not configured. Set CREWAI_BEDROCK_S3_BUCKET \"\n                \"environment variable or pass bucket_name parameter.\"\n            )\n        return self._bucket_name\n\n    @property\n    def bucket_owner(self) -> str | None:\n        \"\"\"Return the configured bucket owner.\"\"\"\n        return self._bucket_owner\n\n    def _get_client(self) -> Any:\n        \"\"\"Get or create the S3 client.\"\"\"\n        if self._client is None:\n            try:\n                import boto3\n\n                self._client = boto3.client(\"s3\", region_name=self._region)\n            except ImportError as e:\n                raise ImportError(\n                    \"boto3 is required for Bedrock S3 file uploads. \"\n                    \"Install with: pip install boto3\"\n                ) from e\n        return self._client\n\n    def _get_async_client(self) -> Any:\n        \"\"\"Get or create the async S3 client.\"\"\"\n        if self._async_client is None:\n            try:\n                import aioboto3  # type: ignore[import-not-found]\n\n                self._session = aioboto3.Session()\n            except ImportError as e:\n                raise ImportError(\n                    \"aioboto3 is required for async Bedrock S3 file uploads. \"\n                    \"Install with: pip install aioboto3\"\n                ) from e\n        return self._session","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/crewAIInc/crewAI/blob/754d7323beb2fd042e33444a115ea2d5a47193f0/lib/crewai-files/src/crewai_files/uploaders/bedrock.py#L149-L185","documentation":"ImportError raised lazily from BedrockFileUploader._get_client when import boto3 fails: the AWS SDK for Python is not installed, so the sync S3 client cannot be created. As with other lazy imports, construction succeeds and the error appears on first client use.","triggerScenarios":"Calling bedrock_uploader.upload(file) (or anything touching _get_client) in an interpreter where boto3 is absent or broken.","commonSituations":"Deploying the Bedrock uploader without installing boto3; running in a slim container image that never included it; a dependency resolver removing boto3 during an unrelated upgrade.","solutions":["pip install boto3 in the active environment.","Verify with python -c \"import boto3; print(boto3.__version__)\" in the same interpreter that runs the app.","Warm the client at startup (uploader._get_client()) to fail fast."],"exampleFix":"# before\nuploader = BedrockFileUploader(bucket_name='b', region_name='us-east-1')\nuploader.upload(file)  # ImportError: boto3 required\n\n# after\n# pip install boto3\nuploader = BedrockFileUploader(bucket_name='b', region_name='us-east-1')\nuploader._get_client()  # fail fast\nuploader.upload(file)","handlingStrategy":"validation","validationCode":"import importlib.util\n\nif importlib.util.find_spec(\"boto3\") is None:\n    raise RuntimeError(\"pip install boto3 required for Bedrock uploads\")","typeGuard":null,"tryCatchPattern":"try:\n    uploader.upload(file)\nexcept ImportError as e:\n    if \"boto3\" in str(e):\n        subprocess.check_call([sys.executable, \"-m\", \"pip\", \"install\", \"boto3\"])  # controlled self-heal\n    raise","preventionTips":["Include boto3 in the deployment image's requirements.","Warm _get_client() at startup to detect missing SDKs before traffic.","Pin boto3 to a known-good version to avoid resolver surprises."],"tags":["import-error","boto3","aws","bedrock","dependency","file-upload"],"backgroundTag":null,"analyzedSha":"754d7323beb2fd042e33444a115ea2d5a47193f0","analyzedAt":"2026-08-15T04:06:56.746Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}