continuedev/continue · warning

Bedrock: failed to process image part

Error message

Bedrock: failed to process image part

What it means

While converting chat message content into Bedrock content blocks, an image part was encountered that did not match any supported format (e.g. base64 data URL with known mime type). The unsupported part is skipped with a warning and the rest of the message is still sent.

Source

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

              format === ImageFormat.WEBP ||
              format === ImageFormat.GIF
            ) {
              blocks.push({
                image: {
                  format,
                  source: {
                    bytes: Uint8Array.from(Buffer.from(base64Data, "base64")),
                  },
                },
              });
            } else {
              console.warn(
                `Bedrock: skipping unsupported image part format: ${format}`,
                part,
              );
            }
          } else {
            console.warn("Bedrock: failed to process image part", part);
          }
        }
      }
    }
    return blocks;
  }

  private async _getCredentials() {
    if (this.accessKeyId && this.secretAccessKey) {
      return {
        accessKeyId: this.accessKeyId,
        secretAccessKey: this.secretAccessKey,
      };
    }
    const profile = this.profile ?? "bedrock";
    try {
      return await fromNodeProviderChain({
        profile: profile,

View on GitHub (pinned to 5522c6f44c)

Solutions

  1. Ensure image parts use data URLs like data:image/png;base64,... with a supported mime type (png/jpeg/gif/webp)
  2. If you have a remote URL, fetch and convert it to a base64 data URL before sending
  3. Log part.imageUrl.url at debug level to identify which message produced it

Example fix

// before
content: [{ type: "image", url: "https://example.com/cat.png" }]
// after
const b64 = await fetch(url).then(r => `data:${r.headers.get("content-type")};base64,${Buffer.from(await r.arrayBuffer()).toString("base64")}`);
content: [{ type: "image", url: b64 }]
Defensive patterns

Strategy: validation

Validate before calling

const ok = p => typeof p.imageUrl?.url === "string" && /^data:image\/(png|jpe?g|gif|webp);base64,[A-Za-z0-9+/=]+$/.test(p.imageUrl.url);

Type guard

const isSupportedBedrockImage = (p: ChatMessagePart): p is { type: "image"; url: string } =>
  !!p.imageUrl?.url && /^data:image\/(png|jpe?g|gif|webp);base64,/.test(p.imageUrl.url);

Prevention

When it happens

Trigger: Calling Bedrock chat with a message whose content includes an image part whose url is not a well-formed data: URL (http(s) remote URL, relative path, or malformed base64), or an image format Bedrock does not accept.

Common situations: Passing a remote image URL instead of base64 data URL; frontend sending an object URL or empty string; upstream provider returning a non-data-URL image reference.

Related errors


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