BerriAI/litellm · error · BedrockError

AWS region not set: set AWS_REGION_NAME or AWS_REGION env…

Error message

AWS region not set: set AWS_REGION_NAME or AWS_REGION env variable or in .env file

What it means

Configuration guard during Bedrock client construction: no AWS region could be resolved from any source (explicit region_name, aws_region_name, litellm params, or AWS_REGION_NAME/AWS_REGION env vars), so the bedrock-runtime endpoint URL cannot be determined.

Solutions

  1. Set AWS_REGION_NAME or AWS_REGION environment variable.
  2. Add the region to the .env file used by the proxy.
  3. Pass aws_region_name in litellm_params.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/llms/bedrock/common_utils.py:446 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/9776b89569269772. Report an issue: GitHub.

Appendix: source

Thrown at litellm/llms/bedrock/common_utils.py:446

        aws_session_name,
        aws_profile_name,
        aws_role_name,
        aws_web_identity_token,
    ) = params_to_check

    ssl_verify: Final = _get_bedrock_client_ssl_verify()

    ### SET REGION NAME
    if region_name:
        pass
    elif aws_region_name:
        region_name = aws_region_name
    elif litellm_aws_region_name:
        region_name = litellm_aws_region_name
    elif standard_aws_region_name:
        region_name = standard_aws_region_name
    else:
        raise BedrockError(
            message="AWS region not set: set AWS_REGION_NAME or AWS_REGION env variable or in .env file",
            status_code=401,
        )

    # check for custom AWS_BEDROCK_RUNTIME_ENDPOINT and use it if not passed to init_bedrock_client
    env_aws_bedrock_runtime_endpoint: Final = get_secret("AWS_BEDROCK_RUNTIME_ENDPOINT")
    if aws_bedrock_runtime_endpoint:
        endpoint_url = aws_bedrock_runtime_endpoint
    elif env_aws_bedrock_runtime_endpoint:
        endpoint_url = env_aws_bedrock_runtime_endpoint
    else:
        endpoint_url = f"https://bedrock-runtime.{region_name}.amazonaws.com"

    import boto3

    if isinstance(timeout, float):
        config = boto3.session.Config(connect_timeout=timeout, read_timeout=timeout)
    elif isinstance(timeout, httpx.Timeout):

View on GitHub (pinned to 77b7c6c40c)