continuedev/continue · error · Error
Error processing Bedrock stream: ${error.message}
Error message
Error processing Bedrock stream: ${error.message} What it means
Thrown when the streaming loop in chatCompletionStream encounters an Error without a `code` property — i.e. a non-AWS error such as a JSON parse failure, a malformed SSE event, or a JS-level exception while decoding chunks. The original message is preserved so you can tell whether the stream data was malformed or something else broke.
Source
Thrown at packages/openai-adapters/src/apis/Bedrock.ts:566
function: {
name: start.toolUse.name,
arguments: undefined,
},
},
],
},
});
}
}
}
} catch (error) {
if (error instanceof Error) {
if ("code" in error) {
throw new Error(
`AWS Bedrock stream error (${(error as any).code}): ${error.message}`,
);
}
throw new Error(`Error processing Bedrock stream: ${error.message}`);
}
throw new Error(
"Error processing Bedrock stream: Unknown error occurred",
);
}
}
completionNonStream(
body: CompletionCreateParamsNonStreaming,
): Promise<Completion> {
throw new Error("Bedrock does not support completions API");
}
completionStream(
body: CompletionCreateParamsStreaming,
): AsyncGenerator<Completion> {
throw new Error("Bedrock does not support completions API");
}View on GitHub (pinned to 5522c6f44c)
Solutions
- Inspect error.message: 'Unexpected token...' usually means a truncated/malformed chunk — retry the request.
- If reproducible with one prompt, check for very large single chunks or content that breaks the adapter's parsing; update the openai-adapters package to the latest patch.
- Test the same request with the AWS CLI (aws bedrock-runtime invoke-model-with-response-stream) to confirm whether the raw stream is healthy.
- If a proxy sits between client and Bedrock, disable response buffering for streaming endpoints.
Defensive patterns
Strategy: retry
Try / catch
try {
for await (const chunk of api.chatCompletionStream(body)) { /* ... */ }
} catch (e) {
if (e instanceof Error && e.message.startsWith('Error processing Bedrock stream')) {
// malformed/truncated stream — safe to retry idempotently
return retryOnce();
}
throw e;
} Prevention
- Disable proxy buffering for streaming endpoints.
- Keep the openai-adapters package updated to match current Bedrock event formats.
- Log error.message to distinguish parse failures from service errors.
When it happens
Trigger: Bedrock returns a truncated or malformed event stream; the adapter tries to JSON.parse a partial/invalid chunk; a TextDecoder or generator iteration error occurs; any runtime Error lacking `code` is raised inside the try block of the stream consumer.
Common situations: Model output interrupted mid-generation (network drop, server-side truncation); proxy or load balancer buffering/corrupting chunked responses; version mismatch between adapter's expected event shape and the actual Bedrock response format.
Related errors
- Malformed JSON received from Bedrock: ${decoded}
- No stream received from Bedrock API
- AWS Bedrock stream error (${(error as any).code}): ${error.m
- Error processing Bedrock stream: Unknown error occurred
- MCP Connection ${serverId} not found
AI-assisted analysis of continuedev/continue@5522c6f44c (2026-08-27).
Data as JSON: /api/errors/94ec159f633d139e.
Report an issue: GitHub.