{"record":{"id":"7a82f18de96f378d","repo":"continuedev/continue","slug":"error-in-bedrockreranker-rerank-unknown-error-occ","errorCode":null,"errorMessage":"Error in BedrockReranker.rerank: Unknown error occurred","messagePattern":"Error in BedrockReranker\\.rerank: Unknown error occurred","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"core/llm/llms/Bedrock.ts","lineNumber":743,"sourceCode":"        return responseBody.results\n          .sort((a: any, b: any) => a.index - b.index)\n          .map((result: any) => result.relevance_score);\n      } catch (e) {\n        throw new Error(\n          `Error parsing JSON from Bedrock response body:\\n${decoded}, ${JSON.stringify(e)}`,\n        );\n      }\n    } catch (error: unknown) {\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\nexport default Bedrock;\n","sourceCodeStart":725,"sourceCodeEnd":751,"githubUrl":"https://github.com/continuedev/continue/blob/5522c6f44ca0ac3528b37244818fbfa39b5af470/core/llm/llms/Bedrock.ts#L725-L751","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Add logging of the raw caught value before the throw to identify the real cause (temporarily patch the catch block)","Check that the Bedrock client was constructed correctly (region, credentials) since misconfig can produce non-Error rejections","Reproduce with a minimal AWS SDK snippet calling InvokeModel with the same rerank payload","Update @aws-sdk/* packages to current v3 versions where all exceptions extend Error"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"function isUnknownRerankError(e: unknown): boolean {\n  return e instanceof Error && e.message === 'Error in BedrockReranker.rerank: Unknown error occurred';\n}","tryCatchPattern":"try {\n  await reranker.rerank(query, chunks);\n} catch (e) {\n  if (isUnknownRerankError(e)) { /* log context, re-run with verbose SDK logging */ }\n  throw e;\n}","preventionTips":["Log the raw caught value in a wrapper to recover the non-Error cause","Avoid custom fetch/middleware that throws plain objects","Pin recent AWS SDK v3 versions"],"tags":["aws","bedrock","rerank","unknown-error"],"backgroundTag":"aws-sdk-error","analyzedSha":"5522c6f44ca0ac3528b37244818fbfa39b5af470","analyzedAt":"2026-08-27T11:28:54.683Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}