continuedev/continue · warning
Bedrock: failed to process image part - invalid URL
Error message
Bedrock: failed to process image part - invalid URL
What it means
While converting OpenAI message parts to Bedrock Converse parts, _oaiPartToBedrockPart parses the image_url as a data URL via parseDataUrl. If parsing returns null (malformed data URL), the image part is replaced with the placeholder text "[Failed to process image]" and this warning is logged, so the request still goes through but without the image.
Source
Thrown at packages/openai-adapters/src/apis/Bedrock.ts:142
): ContentBlock {
switch (part.type) {
case "refusal":
return {
text: part.refusal,
};
case "text":
return {
text: part.text,
};
case "input_audio":
throw new Error("Unsupported part type: input_audio");
case "image_url":
default:
const parsed = parseDataUrl(
(part as ChatCompletionContentPartImage).image_url.url,
);
if (!parsed) {
console.warn("Bedrock: failed to process image part - invalid URL");
return { text: "[Failed to process image]" };
}
const { mimeType, base64Data } = parsed;
const format = mimeType.split("/")[1]?.split(";")[0] || "jpeg";
if (
format === ImageFormat.JPEG ||
format === ImageFormat.PNG ||
format === ImageFormat.WEBP ||
format === ImageFormat.GIF
) {
return {
image: {
format,
source: {
bytes: Uint8Array.from(Buffer.from(base64Data, "base64")),
},
},
};View on GitHub (pinned to 5522c6f44c)
Solutions
- Inline the image as a data URL: `data:image/jpeg;base64,<b64data>`
- Validate the data URL before sending (regex for ^data:[\w./+-]+;base64,[A-Za-z0-9+/=]+$)
- Use a supported format (jpeg/png/gif/webp) in the data URL MIME type
- Re-encode the image to base64 to ensure the payload is valid
Example fix
// before
{ type: "image_url", image_url: { url: remoteUrl } }
// after
const b64 = (await fetch(remoteUrl)).arrayBuffer() |> Buffer.from |> (b) => b.toString("base64");
{ type: "image_url", image_url: { url: `data:image/png;base64,${b64}` } } Defensive patterns
Strategy: validation
Validate before calling
if (!part.image_url.url.startsWith("data:")) {
throw new Error("Bedrock requires inline base64 data URLs for images");
} Type guard
const isDataUrl = (u: string): u is `data:${string};base64,${string}` =>
/^data:[\w./+-]+;base64,[A-Za-z0-9+/=]+$/.test(u); Prevention
- Always inline images as base64 data URLs for Bedrock
- Validate MIME is jpeg/png/gif/webp before sending
- Log placeholders like [Failed to process image] in responses to detect silent drops
When it happens
Trigger: Sending an image_url part with an http(s) URL, a data URL missing the `;base64,` marker, an unsupported/missing MIME type, or corrupted base64 payload to a Bedrock model.
Common situations: Reusing OpenAI-compatible payloads (which allow remote URLs) against Bedrock, which requires inline base64 data URLs; truncated base64 from string manipulation.
Related errors
- Bedrock: failed to process image part
- Anthropic: skipping image with invalid data URL format
- Bedrock: skipping unsupported image part format: ${format}
- Unsupported part type: input_audio
- AWS Bedrock rerank error (${(error as any).code}): ${error.m
AI-assisted analysis of continuedev/continue@5522c6f44c (2026-08-27).
Data as JSON: /api/errors/588e18f7748455c4.
Report an issue: GitHub.