{"record":{"id":"004388905ddac927","repo":"continuedev/continue","slug":"error-processing-bedrock-stream-unknown-error-occ","errorCode":null,"errorMessage":"Error processing Bedrock stream: Unknown error occurred","messagePattern":"Error processing Bedrock stream: Unknown error occurred","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/openai-adapters/src/apis/Bedrock.ts","lineNumber":568,"sourceCode":"                      arguments: undefined,\n                    },\n                  },\n                ],\n              },\n            });\n          }\n        }\n      }\n    } catch (error) {\n      if (error instanceof Error) {\n        if (\"code\" in error) {\n          throw new Error(\n            `AWS Bedrock stream error (${(error as any).code}): ${error.message}`,\n          );\n        }\n        throw new Error(`Error processing Bedrock stream: ${error.message}`);\n      }\n      throw new Error(\n        \"Error processing Bedrock stream: Unknown error occurred\",\n      );\n    }\n  }\n\n  completionNonStream(\n    body: CompletionCreateParamsNonStreaming,\n  ): Promise<Completion> {\n    throw new Error(\"Bedrock does not support completions API\");\n  }\n\n  completionStream(\n    body: CompletionCreateParamsStreaming,\n  ): AsyncGenerator<Completion> {\n    throw new Error(\"Bedrock does not support completions API\");\n  }\n\n  fimStream(","sourceCodeStart":550,"sourceCodeEnd":586,"githubUrl":"https://github.com/continuedev/continue/blob/5522c6f44ca0ac3528b37244818fbfa39b5af470/packages/openai-adapters/src/apis/Bedrock.ts#L550-L586","documentation":"Defensive fallback in chatCompletionStream's catch block: something was thrown that is not an instance of Error (e.g. a string, plain object, or a rejected non-Error promise). Because there is no message to surface, the adapter throws this generic 'Unknown error occurred' error. It almost always indicates an unexpected bug in the stream pipeline rather than a Bedrock service problem.","triggerScenarios":"A promise inside the stream loop rejects with a non-Error value (string throw, plain object, undefined); an AWS SDK middleware or third-party lib throws a non-Error; internal code does `throw 'some string'`.","commonSituations":"Custom fetch/axios wrappers that reject with strings or response objects; older dependencies that throw non-Error values; adapter bugs after an upstream format change.","solutions":["Reproduce with logging around the call to capture what was actually thrown (console.log the caught value before it's wrapped).","Wrap the streaming call and inspect `e.cause` or log the raw rejection to identify the non-Error source.","Update openai-adapters and AWS SDK v3 dependencies — known non-Error throw paths get fixed over time.","If your own code intercepts the stream (custom fetch), ensure it only rejects with Error instances."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await api.chatCompletionStream(body);\n} catch (e) {\n  if (e instanceof Error && e.message === 'Error processing Bedrock stream: Unknown error occurred') {\n    // non-Error thrown upstream — log and report as adapter/dependency bug\n    logger.error('Non-Error rejection from Bedrock stream pipeline');\n  }\n  throw e;\n}","preventionTips":["Ensure any custom fetch/transport wrappers reject only with Error instances.","Pin dependency versions to avoid SDK behavior drift.","Capture and log the raw thrown value when this occurs to find the source."],"tags":["bedrock","streaming","unknown-error","defensive"],"backgroundTag":"non-error-rejection","analyzedSha":"5522c6f44ca0ac3528b37244818fbfa39b5af470","analyzedAt":"2026-08-27T11:28:54.683Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}