{"record":{"id":"ae8da2c3c4d2c9bc","repo":"BerriAI/litellm","slug":"missing-boto3-to-call-bedrock-run-pip-install-bo-ae8da2","errorCode":null,"errorMessage":"Missing boto3 to call bedrock. Run 'pip install boto3'.","messagePattern":"Missing boto3 to call bedrock\\. Run 'pip install boto3'\\.","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"litellm/llms/bedrock/embed/embedding.py","lineNumber":49,"sourceCode":"from .amazon_nova_transformation import AmazonNovaEmbeddingConfig\nfrom .amazon_titan_g1_transformation import AmazonTitanG1Config\nfrom .amazon_titan_multimodal_transformation import (\n    AmazonTitanMultimodalEmbeddingG1Config,\n)\nfrom .amazon_titan_v2_transformation import AmazonTitanV2Config\nfrom .cohere_transformation import BedrockCohereEmbeddingConfig\nfrom .twelvelabs_marengo_transformation import TwelveLabsMarengoEmbeddingConfig\n\n\nclass BedrockEmbedding(BaseAWSLLM):\n    def _load_credentials(\n        self,\n        optional_params: dict,\n    ) -> tuple[Any, str]:\n        try:\n            from botocore.credentials import Credentials\n        except ImportError:\n            raise ImportError(\"Missing boto3 to call bedrock. Run 'pip install boto3'.\")\n        ## CREDENTIALS ##\n        # pop aws_secret_access_key, aws_access_key_id, aws_session_token, aws_region_name from kwargs, since completion calls fail with them\n        aws_secret_access_key: Final = optional_params.pop(\"aws_secret_access_key\", None)\n        aws_access_key_id: Final = optional_params.pop(\"aws_access_key_id\", None)\n        aws_session_token: Final = optional_params.pop(\"aws_session_token\", None)\n        aws_region_name = optional_params.pop(\"aws_region_name\", None)\n        aws_role_name: Final = optional_params.pop(\"aws_role_name\", None)\n        aws_session_name: Final = optional_params.pop(\"aws_session_name\", None)\n        aws_profile_name: Final = optional_params.pop(\"aws_profile_name\", None)\n        aws_web_identity_token: Final = optional_params.pop(\"aws_web_identity_token\", None)\n        aws_sts_endpoint: Final = optional_params.pop(\"aws_sts_endpoint\", None)\n\n        ### SET REGION NAME ###\n        if aws_region_name is None:\n            # check env #\n            litellm_aws_region_name: Final = get_secret(\"AWS_REGION_NAME\", None)\n\n            if litellm_aws_region_name is not None and isinstance(litellm_aws_region_name, str):","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/bedrock/embed/embedding.py#L31-L67","documentation":"The Bedrock embedding path imports botocore.credentials to construct AWS credentials; if boto3/botocore is absent, it fails immediately with this ImportError. It fires before any credential resolution or network activity.","triggerScenarios":"Calling litellm.embedding with a bedrock/* model in an environment lacking boto3 — e.g. litellm installed without AWS extras, or a slim container image.","commonSituations":"Fresh venvs, Docker images based on python-slim without build deps, CI runners with cached old lockfiles that dropped botocore, or deploying the LiteLLM proxy from a minimal base image.","solutions":["pip install boto3 in the interpreter running your app","Add boto3 to project dependencies and rebuild the deployment image","Sanity check: python -c \"import botocore.credentials\""],"exampleFix":"# before\npip install litellm\n# after\npip install litellm boto3\npython -c \"import botocore.credentials; print('ok')\"","handlingStrategy":"type-guard","validationCode":"def aws_deps_ok() -> bool:\n    try:\n        import botocore.credentials  # noqa: F401\n        return True\n    except ImportError:\n        return False\n\nif not aws_deps_ok():\n    raise SystemExit(\"Missing boto3 to call bedrock. Run 'pip install boto3'.\")","typeGuard":null,"tryCatchPattern":"try:\n    from litellm import embedding\n    resp = embedding(model=\"bedrock/...\", input=[\"hi\"])\nexcept ImportError as e:\n    if \"boto3\" in str(e):\n        sys.exit(\"install boto3 to use the bedrock provider\")\n    raise","preventionTips":["Declare boto3 as a hard dependency wherever bedrock models are configured","Fail fast at app startup with an import check rather than at first embedding request"],"tags":["bedrock","boto3","dependencies","aws","embedding"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}