High severity HTTP 404 beginner · Fix: 2-5 min

ResourceNotFoundException

aws_bedrock.ResourceNotFoundException

What this error means
AWS Bedrock throws ResourceNotFoundException when the specified model ID does not exist or is misspelled.

Stack trace

traceback
aws_bedrock.ResourceNotFoundException: The requested model 'model-id' was not found in AWS Bedrock.
    at aws_bedrock.client.invoke_model(...)
QUICK FIX
Double-check and correct the model ID string to match an existing model in your AWS Bedrock region.

Why it happens

This error occurs because the model identifier provided to the AWS Bedrock client does not match any available models in the AWS Bedrock service. It can happen due to typos, using a model ID that was deleted, or referencing a model from a different AWS region.

Detection

Check the model ID string before making the API call and verify it against the list of available models in your AWS Bedrock console or via the SDK list_models method.

Causes & fixes

1

Incorrect or misspelled model ID passed to the Bedrock client.

✓ Fix

Verify and correct the model ID string to exactly match the model name registered in AWS Bedrock.

2

Model ID references a model that was deleted or is not deployed in the current AWS region.

✓ Fix

Confirm the model is deployed and available in the AWS region configured in your client.

3

AWS credentials or permissions do not allow access to the specified model.

✓ Fix

Ensure your AWS IAM role or user has permissions to access the model resource in Bedrock.

Code: broken vs fixed

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

client = BedrockClient(region_name='us-west-2')

response = client.invoke_model(model_id='wrong-model-id', input_text='Hello')  # This line triggers ResourceNotFoundException
print(response)
Fixed - works correctly
python
import os
from aws_bedrock import BedrockClient

client = BedrockClient(region_name='us-west-2')

# Corrected model_id to existing model
response = client.invoke_model(model_id=os.environ['BEDROCK_MODEL_ID'], input_text='Hello')  # Fixed model ID usage
print(response)
Replaced hardcoded incorrect model ID with environment variable holding the correct model ID to avoid typos and ensure valid model reference.

Workaround

Catch ResourceNotFoundException and fallback to listing available models with client.list_models(), then select a valid model ID dynamically.

Prevention

Implement validation logic to confirm model IDs against the list_models API before invoking models, and use environment variables or configuration management to avoid hardcoding model IDs.

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

Community Notes

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