Mintplex-Labs/anything-llm · error

AWSBedrock::getChatCompletion failed.

Error message

AWSBedrock::getChatCompletion failed. ${e.message}

What it means

Catch wrapper in AWSBedrockLLM.getChatCompletion: the OpenAI-compatible Bedrock call rejected (auth, throttling, model, or network error); the error is logged with provider context and its message rethrown for upstream handling.

Solutions

  1. Check AWS credentials and region configuration.
  2. Verify the Bedrock model id is available in your region.
  3. Review the embedded error message from the AWS SDK.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown when a chat completion request to AWS Bedrock fails.

Common situations: Bad credentials, model not enabled in the region, or throttling.


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

Appendix: source

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

    if (!messages?.length)
      throw new Error(
        "AWSBedrock::getChatCompletion requires a non-empty messages array."
      );

    if (this.#isAnthropic) {
      return this.#anthropicChatCompletion(messages, temperature);
    }

    const result = await LLMPerformanceMonitor.measureAsyncFunction(
      this.openai.chat.completions
        .create({
          model: this.model,
          messages,
          temperature: this.temperatureParam(temperature),
        })
        .catch((e) => {
          this.#log(`Bedrock API Error (getChatCompletion): ${e.message}`, e);
          throw new Error(`AWSBedrock::getChatCompletion failed. ${e.message}`);
        })
    );

    const response = result.output;
    if (!response?.choices?.[0]?.message) {
      this.#log("Bedrock response missing expected structure.", response);
      return null;
    }

    return {
      textResponse: response.choices[0].message.content,
      metrics: this.#buildMetrics(response.usage, result.duration),
    };
  }

  async streamGetChatCompletion(messages = null, { temperature }) {
    if (!Array.isArray(messages) || messages.length === 0) {
      throw new Error(

View on GitHub (pinned to 20f6d3546c)