High severity beginner · Fix: 2-5 min

ModelNotAvailableException

aws_bedrock.exceptions.ModelNotAvailableException

What this error means
AWS Bedrock returns ModelNotAvailableException when the requested model is not deployed or supported in the current AWS region.

Stack trace

traceback
aws_bedrock.exceptions.ModelNotAvailableException: The requested model is not available in the current AWS region.
    at aws_bedrock.client.invoke_model (client.py:123)
    at app.main (main.py:45)
QUICK FIX
Set your AWS Bedrock client region to a supported region where the model is available before invoking the model.

Why it happens

AWS Bedrock models are region-specific and not all models are deployed in every AWS region. If your client is configured to use a region where the model is not available, the service throws this exception. This prevents calls to unsupported endpoints and ensures compliance with regional deployments.

Detection

Check the AWS region configured in your Bedrock client before making model calls. Validate model availability via AWS console or Bedrock API before runtime to avoid this error.

Causes & fixes

1

The AWS Bedrock client is configured to a region where the requested model is not deployed.

✓ Fix

Change the AWS region in your client configuration to a region where the model is available, such as us-east-1 or us-west-2.

2

The model name specified is incorrect or deprecated in the current region.

✓ Fix

Verify the exact model name supported in your region via AWS Bedrock documentation or console and update your code accordingly.

3

Using default AWS region environment variables that do not match the model's deployment region.

✓ Fix

Explicitly set the AWS_REGION environment variable or client region parameter to the correct region supporting the model.

Code: broken vs fixed

Broken - triggers the error
python
import os
from aws_bedrock import BedrockClient

client = BedrockClient(region_name=os.environ.get('AWS_REGION'))
response = client.invoke_model(model_id='anthropic.claude-v1', input='Hello')  # This line raises ModelNotAvailableException
Fixed - works correctly
python
import os
from aws_bedrock import BedrockClient

# Set region explicitly to a supported region for the model
os.environ['AWS_REGION'] = 'us-east-1'
client = BedrockClient(region_name=os.environ.get('AWS_REGION'))
response = client.invoke_model(model_id='anthropic.claude-v1', input='Hello')  # Fixed: region set correctly
print(response)
Explicitly setting the AWS_REGION environment variable to a region where the model is available ensures the Bedrock client connects to the correct regional endpoint, preventing the ModelNotAvailableException.

Workaround

Catch ModelNotAvailableException and fallback to a different region or model dynamically by querying available models via the Bedrock API before invocation.

Prevention

Implement region validation logic in your deployment pipeline or startup code to confirm model availability in the configured region, and use AWS Bedrock's model listing APIs to dynamically select supported models per region.

Python 3.9+ · aws-bedrock-sdk >=1.0.0 · tested on 1.0.x
Verified 2026-04
Verify ↗

Community Notes

No notes yetBe the first to share a version-specific fix or tip.