{"record":{"id":"b4cc09ee0e0dd150","repo":"crewAIInc/crewAI","slug":"aioboto3-is-required-for-async-bedrock-s3-file-upl","errorCode":null,"errorMessage":"aioboto3 is required for async Bedrock S3 file uploads. Install with: pip install aioboto3","messagePattern":"aioboto3 is required for async Bedrock S3 file uploads\\. Install with: pip install aioboto3","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"lib/crewai-files/src/crewai_files/uploaders/bedrock.py","lineNumber":181,"sourceCode":"                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\n\n    def _generate_s3_key(self, file: FileInput, content: bytes | None = None) -> str:\n        \"\"\"Generate a unique S3 key for the file.\n\n        For FilePath sources with no content provided, computes hash via streaming.\n\n        Args:\n            file: The file being uploaded.\n            content: The file content bytes (optional for FilePath sources).\n\n        Returns:\n            S3 key string.\n        \"\"\"\n        if content is not None:","sourceCodeStart":163,"sourceCodeEnd":199,"githubUrl":"https://github.com/crewAIInc/crewAI/blob/754d7323beb2fd042e33444a115ea2d5a47193f0/lib/crewai-files/src/crewai_files/uploaders/bedrock.py#L163-L199","documentation":"ImportError raised from BedrockFileUploader._get_async_client when import aioboto3 fails. The async path needs the separate aioboto3 package in addition to boto3, so having boto3 alone is not enough for async uploads.","triggerScenarios":"Awaiting bedrock_uploader.async_upload(file) when aioboto3 is not installed; common when only boto3 was installed to satisfy the sync path.","commonSituations":"Sync tests pass (boto3 present) but the async worker fails at runtime; aioboto3 omitted from requirements.txt; version pinning removed aioboto3 during a lock refresh.","solutions":["pip install aioboto3 (keep boto3 installed too; both are needed).","Confirm in the worker's interpreter: python -c \"import aioboto3\".","Warm uploader._get_async_client() during async app startup so the ImportError surfaces before traffic."],"exampleFix":"# before\nasync def upload(file):\n    return await bedrock_uploader.async_upload(file)  # ImportError: aioboto3 required\n\n# after\n# pip install aioboto3\nbedrock_uploader._get_async_client()  # fail fast at startup\nasync def upload(file):\n    return await bedrock_uploader.async_upload(file)","handlingStrategy":"validation","validationCode":"import importlib.util\n\nif importlib.util.find_spec(\"aioboto3\") is None:\n    raise RuntimeError(\"pip install aioboto3 required for async Bedrock uploads\")","typeGuard":null,"tryCatchPattern":"try:\n    result = await uploader.async_upload(file)\nexcept ImportError as e:\n    if \"aioboto3\" in str(e):\n        logger.error(\"install aioboto3 in the worker environment\")\n    raise","preventionTips":["Install both boto3 (sync) and aioboto3 (async) when enabling Bedrock uploads.","Smoke-test the async client construction in CI with the same extras as prod.","Warm _get_async_client() during startup."],"tags":["import-error","aioboto3","async","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"}