continuedev/continue · error · Error

Error in BedrockReranker.rerank

Error message

Error in BedrockReranker.rerank: ${error.message}

What it means

Generic wrapper thrown by BedrockReranker.rerank when the rerank call fails with a standard Error that is not an AWS SDK coded error. The original error message is preserved with the 'Error in BedrockReranker.rerank' prefix. Typical causes are network-level failures or unexpected exceptions raised while calling the Bedrock runtime client.

Solutions

  1. Read the embedded message to identify the underlying cause (fetch failed, ENOTFOUND, credentials not found, etc.)
  2. Verify AWS region and connectivity: curl https://bedrock-runtime.<region>.amazonaws.com
  3. If credentials are missing, export AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY/AWS_REGION or configure a shared credentials file
  4. Upgrade @aws-sdk/client-bedrock-runtime if the message indicates serialization/protocol issues
Defensive patterns

Strategy: try-catch

Try / catch

try {
  await reranker.rerank(query, chunks);
} catch (e) {
  if (e instanceof Error && e.message.startsWith('Error in BedrockReranker.rerank:')) {
    logger.error('Bedrock rerank failure:', e.message);
  }
  throw e;
}

Prevention

When it happens

Trigger: Network outage/DNS failure while calling bedrockruntime.send(InvokeModelCommand), misconfigured region causing endpoint resolution failure, missing AWS credentials producing a non-SDK error, or a bug in the request serialization.

Common situations: Running in an environment without outbound network access to bedrock-runtime.<region>.amazonaws.com, unset AWS_REGION, corporate proxy interference, or Node fetch/undici incompatibilities with the SDK v3 client.

Related errors


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

Appendix: source

Thrown at core/llm/llms/Bedrock.ts:741

        const responseBody = JSON.parse(decoded);
        // Sort results by index to maintain original order
        return responseBody.results
          .sort((a: any, b: any) => a.index - b.index)
          .map((result: any) => result.relevance_score);
      } catch (e) {
        throw new Error(
          `Error parsing JSON from Bedrock response body:\n${decoded}, ${JSON.stringify(e)}`,
        );
      }
    } catch (error: unknown) {
      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",
      );
    }
  }
}

export default Bedrock;

View on GitHub (pinned to 5522c6f44c)