continuedev/continue · error · Error

Error in BedrockReranker.rerank: Unknown error occurred

Error message

Error in BedrockReranker.rerank: Unknown error occurred

What it means

Last-resort error thrown by BedrockReranker.rerank when the caught value is not an instanceof Error (e.g. a string, plain object, or an SDK exception without a message). It gives no detail about the original failure, so the raw thrown value must be inferred from context or logged separately.

Source

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

        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)

Solutions

  1. Add logging of the raw caught value before the throw to identify the real cause (temporarily patch the catch block)
  2. Check that the Bedrock client was constructed correctly (region, credentials) since misconfig can produce non-Error rejections
  3. Reproduce with a minimal AWS SDK snippet calling InvokeModel with the same rerank payload
  4. Update @aws-sdk/* packages to current v3 versions where all exceptions extend Error
Defensive patterns

Strategy: try-catch

Type guard

function isUnknownRerankError(e: unknown): boolean {
  return e instanceof Error && e.message === 'Error in BedrockReranker.rerank: Unknown error occurred';
}

Try / catch

try {
  await reranker.rerank(query, chunks);
} catch (e) {
  if (isUnknownRerankError(e)) { /* log context, re-run with verbose SDK logging */ }
  throw e;
}

Prevention

When it happens

Trigger: A non-Error value is thrown inside the rerank try block: AWS SDK v3 can occasionally reject with non-Error objects, or custom middleware/interceptors throw plain strings or objects. Also triggered when undefined/null propagates from a broken client call.

Common situations: Custom fetch implementations that reject with Response objects, older SDK versions throwing plain-object exceptions, or memory/stack overflow producing non-Error throws. Almost always masks a configuration problem surfaced as a nonstandard exception.

Related errors


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