Skip to content

SVG images incorrectly handled as ImagePart causing "Unsupported MIME type" error #2714

@giselles-ai

Description

@giselles-ai

Description

When an SVG file is uploaded and used in a generation, the system throws an error:

UnknownError: Unsupported MIME type: image/svg+xml

Root Cause

In packages/giselle/src/generations/internal/use-generation-executor.ts:570, image/svg+xml is treated as an ImagePart and sent to the LLM provider. However, none of the major LLM providers support SVG format for vision/image input.

Supported Image Formats by Provider

Provider Supported Formats SVG Support
OpenAI JPEG, PNG, GIF, WebP Not supported
Anthropic (Claude) JPEG, PNG, GIF, WebP Not supported
Google (Gemini) JPEG, PNG, WebP, HEIC, HEIF Not supported

References

Proposed Solutions

  1. Remove SVG from ImagePart handling - Treat SVG as unsupported and log a warning (simplest)
  2. Convert SVG to raster format - Server-side conversion to PNG before sending to LLM
  3. Treat SVG as text - Since SVG is XML, it could potentially be sent as text content

Current Code

switch (fileParameter.type) {
  case "image/jpeg":
  case "image/png":
  case "image/gif":
  case "image/svg+xml":  // <- This should not be treated as ImagePart
    return {
      type: "image",
      image: blob,
    } as ImagePart;

Metadata

Metadata

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions