crewAIInc/crewAI · error · ImportError
aioboto3 is required for async Bedrock S3 file uploads…
Error message
aioboto3 is required for async Bedrock S3 file uploads. Install with: pip install aioboto3
What it means
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.
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.
Example fix
# before
async def upload(file):
return await bedrock_uploader.async_upload(file) # ImportError: aioboto3 required
# after
# pip install aioboto3
bedrock_uploader._get_async_client() # fail fast at startup
async def upload(file):
return await bedrock_uploader.async_upload(file) Defensive patterns
Strategy: validation
Validate before calling
import importlib.util
if importlib.util.find_spec("aioboto3") is None:
raise RuntimeError("pip install aioboto3 required for async Bedrock uploads") Try / catch
try:
result = await uploader.async_upload(file)
except ImportError as e:
if "aioboto3" in str(e):
logger.error("install aioboto3 in the worker environment")
raise Prevention
- 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.
When it happens
Trigger: Awaiting bedrock_uploader.async_upload(file) when aioboto3 is not installed; common when only boto3 was installed to satisfy the sync path.
Common situations: 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.
Related errors
- boto3 is required for Bedrock S3 file uploads. Install…
- `boto3` package not found, please run `uv add boto3`
- anthropic is required for Anthropic file uploads. Install…
- `boto3` package not found, please run `uv add boto3`
- `boto3` package not found, please run `uv add boto3`
AI-assisted analysis of crewAIInc/crewAI@754d7323be (2026-08-15).
Data as JSON: /api/errors/b4cc09ee0e0dd150.
Report an issue: GitHub.
Appendix: source
Thrown at lib/crewai-files/src/crewai_files/uploaders/bedrock.py:181
import boto3
self._client = boto3.client("s3", region_name=self._region)
except ImportError as e:
raise ImportError(
"boto3 is required for Bedrock S3 file uploads. "
"Install with: pip install boto3"
) from e
return self._client
def _get_async_client(self) -> Any:
"""Get or create the async S3 client."""
if self._async_client is None:
try:
import aioboto3 # type: ignore[import-not-found]
self._session = aioboto3.Session()
except ImportError as e:
raise ImportError(
"aioboto3 is required for async Bedrock S3 file uploads. "
"Install with: pip install aioboto3"
) from e
return self._session
def _generate_s3_key(self, file: FileInput, content: bytes | None = None) -> str:
"""Generate a unique S3 key for the file.
For FilePath sources with no content provided, computes hash via streaming.
Args:
file: The file being uploaded.
content: The file content bytes (optional for FilePath sources).
Returns:
S3 key string.
"""
if content is not None:View on GitHub (pinned to 754d7323be)