Mintplex-Labs/anything-llm · error

AWS_BEDROCK_LLM_API_KEY is required for AWS Bedrock.

Error message

AWS_BEDROCK_LLM_API_KEY is required for AWS Bedrock.

What it means

Configuration guard thrown by the AWSBedrockLLM constructor: the bedrock provider is selected but AWS_BEDROCK_LLM_API_KEY is empty/unset, so the Bedrock runtime client has no credential and construction aborts.

Solutions

  1. Set the AWS_BEDROCK_LLM_API_KEY environment variable.
  2. Configure the AWS Bedrock API key in AnythingLLM provider settings.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at provider construction when AWS_BEDROCK_LLM_API_KEY is missing.

Common situations: AWS Bedrock selected as LLM provider without an API key configured.


AI-assisted analysis of Mintplex-Labs/anything-llm@20f6d3546c (2026-08-18). Data as JSON: /api/errors/e2a0b1d8d56fc4e8. Report an issue: GitHub.

Appendix: source

Thrown at server/utils/AiProviders/bedrock/index.js:63

class AWSBedrockLLM {
  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: openaiBaseURL(this.region),

View on GitHub (pinned to 20f6d3546c)