{"record":{"id":"29faa92b560cc7f6","repo":"continuedev/continue","slug":"aws-bedrock-rerank-error-error-as-any-code-29faa9","errorCode":null,"errorMessage":"AWS Bedrock rerank error (${(error as any).code}): ${error.message}","messagePattern":"AWS Bedrock rerank error \\((.+?)\\): (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/openai-adapters/src/apis/Bedrock.ts","lineNumber":704,"sourceCode":"        body.model,\n        payload,\n      );\n      const scores = responseBody.results\n        .sort((a: any, b: any) => a.index - b.index)\n        .map((result: any) => result.relevance_score);\n\n      return rerank({\n        model: body.model,\n        usage: {\n          total_tokens: 0,\n        },\n        data: scores,\n      });\n    } catch (error) {\n      if (error instanceof Error) {\n        if (\"code\" in error) {\n          // AWS SDK specific errors\n          throw new Error(\n            `AWS Bedrock rerank error (${(error as any).code}): ${error.message}`,\n          );\n        }\n        throw new Error(`Error in BedrockReranker.rerank: ${error.message}`);\n      }\n      throw new Error(\n        \"Error in BedrockReranker.rerank: Unknown error occurred\",\n      );\n    }\n  }\n\n  list(): Promise<Model[]> {\n    throw new Error(\"Method not implemented.\");\n  }\n}\n","sourceCodeStart":686,"sourceCodeEnd":720,"githubUrl":"https://github.com/continuedev/continue/blob/5522c6f44ca0ac3528b37244818fbfa39b5af470/packages/openai-adapters/src/apis/Bedrock.ts#L686-L720","documentation":"BedrockReranker.rerank wraps AWS SDK errors that carry a `code` property (e.g. AccessDeniedException, ThrottlingException, ValidationException) into a descriptive Error. The original AWS error code and message are embedded in the string.","triggerScenarios":"Invalid modelId in the AWS bedrock agent runtime rerank call, missing iam:InvokeModel permissions, throttling, wrong region, or malformed AWS credentials.","commonSituations":"Typo in the rerank model ID; IAM role lacking bedrock:InvokeModel on the rerank model ARN; rate limits under load; region mismatch where the model is not available.","solutions":["Match the embedded AWS code: fix modelId for ValidationException, add IAM bedrock:InvokeModel for AccessDeniedException, backoff for ThrottlingException.","Verify the rerank model (e.g. amazon.rerank-v1) is available in your configured AWS region.","Check AWS credentials/region config on the Bedrock client."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":"const isAwsCodedError = (e: unknown): e is Error & { code: string } => e instanceof Error && 'code' in e;","tryCatchPattern":"try { await bedrock.rerank(body); } catch (e) { if (/Throttling|TooManyRequests/.test(String(e))) await backoff(); else throw e; }","preventionTips":["Verify modelId and IAM bedrock:InvokeModel permissions before deploying.","Implement exponential backoff for ThrottlingException."],"tags":["aws","bedrock","sdk-error","rerank"],"backgroundTag":"aws-sdk-error","analyzedSha":"5522c6f44ca0ac3528b37244818fbfa39b5af470","analyzedAt":"2026-08-27T11:28:54.683Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}