continuedev/continue · error · Error

AWS Bedrock rerank error (${(error as any).code}): ${error.m

Error message

AWS Bedrock rerank error (${(error as any).code}): ${error.message}

What it means

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.

Source

Thrown at packages/openai-adapters/src/apis/Bedrock.ts:704

        body.model,
        payload,
      );
      const scores = responseBody.results
        .sort((a: any, b: any) => a.index - b.index)
        .map((result: any) => result.relevance_score);

      return rerank({
        model: body.model,
        usage: {
          total_tokens: 0,
        },
        data: scores,
      });
    } catch (error) {
      if (error instanceof Error) {
        if ("code" in error) {
          // AWS SDK specific errors
          throw new Error(
            `AWS Bedrock rerank error (${(error as any).code}): ${error.message}`,
          );
        }
        throw new Error(`Error in BedrockReranker.rerank: ${error.message}`);
      }
      throw new Error(
        "Error in BedrockReranker.rerank: Unknown error occurred",
      );
    }
  }

  list(): Promise<Model[]> {
    throw new Error("Method not implemented.");
  }
}

View on GitHub (pinned to 5522c6f44c)

Solutions

  1. Match the embedded AWS code: fix modelId for ValidationException, add IAM bedrock:InvokeModel for AccessDeniedException, backoff for ThrottlingException.
  2. Verify the rerank model (e.g. amazon.rerank-v1) is available in your configured AWS region.
  3. Check AWS credentials/region config on the Bedrock client.
Defensive patterns

Strategy: retry

Type guard

const isAwsCodedError = (e: unknown): e is Error & { code: string } => e instanceof Error && 'code' in e;

Try / catch

try { await bedrock.rerank(body); } catch (e) { if (/Throttling|TooManyRequests/.test(String(e))) await backoff(); else throw e; }

Prevention

When it happens

Trigger: Invalid modelId in the AWS bedrock agent runtime rerank call, missing iam:InvokeModel permissions, throttling, wrong region, or malformed AWS credentials.

Common situations: 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.

Related errors


AI-assisted analysis of continuedev/continue@5522c6f44c (2026-08-27). Data as JSON: /api/errors/29faa92b560cc7f6. Report an issue: GitHub.