{"record":{"id":"0924fb64999bc43f","repo":"Mintplex-Labs/anything-llm","slug":"awsbedrock-getchatcompletion-failed-e-message","errorCode":null,"errorMessage":"AWSBedrock::getChatCompletion failed. ${e.message}","messagePattern":"AWSBedrock::getChatCompletion failed\\. (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/utils/AiProviders/bedrock/index.js","lineNumber":233,"sourceCode":"    if (!messages?.length)\n      throw new Error(\n        \"AWSBedrock::getChatCompletion requires a non-empty messages array.\"\n      );\n\n    if (this.#isAnthropic) {\n      return this.#anthropicChatCompletion(messages, temperature);\n    }\n\n    const result = await LLMPerformanceMonitor.measureAsyncFunction(\n      this.openai.chat.completions\n        .create({\n          model: this.model,\n          messages,\n          temperature: this.temperatureParam(temperature),\n        })\n        .catch((e) => {\n          this.#log(`Bedrock API Error (getChatCompletion): ${e.message}`, e);\n          throw new Error(`AWSBedrock::getChatCompletion failed. ${e.message}`);\n        })\n    );\n\n    const response = result.output;\n    if (!response?.choices?.[0]?.message) {\n      this.#log(\"Bedrock response missing expected structure.\", response);\n      return null;\n    }\n\n    return {\n      textResponse: response.choices[0].message.content,\n      metrics: this.#buildMetrics(response.usage, result.duration),\n    };\n  }\n\n  async streamGetChatCompletion(messages = null, { temperature }) {\n    if (!Array.isArray(messages) || messages.length === 0) {\n      throw new Error(","sourceCodeStart":215,"sourceCodeEnd":251,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/20f6d3546c1938bfea1ad304f58a592dddcc5948/server/utils/AiProviders/bedrock/index.js#L215-L251","documentation":"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.","triggerScenarios":"Thrown when a chat completion request to AWS Bedrock fails.","commonSituations":"Bad credentials, model not enabled in the region, or throttling.","solutions":["Check AWS credentials and region configuration.","Verify the Bedrock model id is available in your region.","Review the embedded error message from the AWS SDK."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"20f6d3546c1938bfea1ad304f58a592dddcc5948","analyzedAt":"2026-08-18T10:02:21.017Z","contentChangedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}