Mintplex-Labs/anything-llm · critical · Error
AWS_BEDROCK_LLM_REGION is required for AWS Bedrock.
Error message
AWS_BEDROCK_LLM_REGION is required for AWS Bedrock.
What it means
Thrown by the AWSBedrockLLM constructor when process.env.AWS_BEDROCK_LLM_REGION is falsy, immediately after the API-key guard. Bedrock endpoints are regional (e.g. us-east-1), so the region is required both for the endpoint URL and for the underlying client. Without it the provider cannot compute a baseURL.
Source
Thrown at server/utils/AiProviders/bedrock/index.js:33
noSystemPromptModels = [
"amazon.titan-text-express-v1",
"amazon.titan-text-lite-v1",
"cohere.command-text-v14",
"cohere.command-light-text-v14",
"us.deepseek.r1-v1:0",
];
noTemperatureModels = [
"anthropic.claude-opus-4-7",
"anthropic.claude-opus-4-8",
"anthropic.claude-sonnet-5",
];
constructor(embedder = null, modelPreference = null) {
if (!process.env.AWS_BEDROCK_LLM_API_KEY)
throw new Error("AWS_BEDROCK_LLM_API_KEY is required for AWS Bedrock.");
if (!process.env.AWS_BEDROCK_LLM_REGION)
throw new Error("AWS_BEDROCK_LLM_REGION is required for AWS Bedrock.");
this.className = "AWSBedrockLLM";
this.model =
modelPreference || process.env.AWS_BEDROCK_LLM_MODEL_PREFERENCE;
this.region = process.env.AWS_BEDROCK_LLM_REGION;
const contextWindowLimit = this.promptWindowLimit();
this.limits = {
history: Math.floor(contextWindowLimit * 0.15),
system: Math.floor(contextWindowLimit * 0.15),
user: Math.floor(contextWindowLimit * 0.7),
};
this.openai = new OpenAIApi({
apiKey: process.env.AWS_BEDROCK_LLM_API_KEY,
baseURL: `https://bedrock-mantle.${this.region}.api.aws/v1`,
});
View on GitHub (pinned to 526360e320)
Solutions
- Set `AWS_BEDROCK_LLM_REGION=<region>` (e.g. us-east-1, eu-west-1) in .env to match where your Bedrock models are available.
- Confirm the region actually hosts the model in AWS_BEDROCK_LLM_MODEL_PREFERENCE.
- Re-save Bedrock credentials in the UI to persist the region.
- Restart the server after editing .env.
Example fix
// before // .env AWS_BEDROCK_LLM_API_KEY=<key> // no region // after AWS_BEDROCK_LLM_API_KEY=<key> AWS_BEDROCK_LLM_REGION=us-east-1
Defensive patterns
Strategy: validation
Validate before calling
const region = process.env.AWS_BEDROCK_LLM_REGION;
const VALID_REGIONS = /^(us|eu|ap|ca|sa|af|me)-(central|east|west|north|south|southeast|southwest|northeast)-\d+/;
if (!region || !VALID_REGIONS.test(region)) {
throw new Error(
"AWS_BEDROCK_LLM_REGION is missing or malformed (e.g. us-east-1)."
);
} Type guard
/** @param {unknown} r @returns {boolean} */
function isAwsRegion(r) {
return typeof r === "string" && /^[a-z]{2}-[a-z]+-\d+$/.test(r);
} Try / catch
try {
const llm = new AWSBedrockLLM(embedder, modelPref);
} catch (e) {
if (/AWS_BEDROCK_LLM_REGION is required/.test(e.message)) {
return { ok: false, reason: "missing-region" };
}
throw e;
} Prevention
- Pick a region that actually hosts your Bedrock models — availability is regional.
- Don't rely on AWS_REGION/AWS_DEFAULT_REGION; this provider reads its own var.
- Validate key+region+model together at save time.
- Restart the server after region changes.
When it happens
Trigger: Constructing AWSBedrockLLM with AWS_BEDROCK_LLM_API_KEY set but AWS_BEDROCK_LLM_REGION missing. Fires at construction, before any chat call.
Common situations: Key pasted but region omitted; region stored under AWS_REGION (the SDK default) instead of the provider-specific AWS_BEDROCK_LLM_REGION; copy-paste missing the region line; wrong region for the deployed model.
Related errors
- AWS_BEDROCK_LLM_API_KEY is required for AWS Bedrock.
- No Anthropic API key was set.
- No ApiPie LLM API key was set.
- No Azure API endpoint was set.
- No Azure API key was set.
AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13).
Data as JSON: /api/errors/bf3b587f9da76e66.
Report an issue: GitHub.