immich-app/immich · warning · BadRequestException

Editing SVG images is not supported

Error message

Editing SVG images is not supported

What it means

Thrown by editAsset when asset.originalPath ends with '.svg' (case-insensitive). SVGs are vector graphics, not raster pixel data, so crop/rotate/mirror pixel operations do not apply; the editor rejects them with 400 BadRequest.

Source

Thrown at server/src/services/asset.service.ts:552

    if (asset.type !== AssetType.Image) {
      throw new BadRequestException('Only images can be edited');
    }

    if (asset.livePhotoVideoId) {
      throw new BadRequestException('Editing live photos is not supported');
    }

    if (isPanorama(asset)) {
      throw new BadRequestException('Editing panorama images is not supported');
    }

    if (asset.originalPath?.toLowerCase().endsWith('.gif')) {
      throw new BadRequestException('Editing GIF images is not supported');
    }

    if (asset.originalPath?.toLowerCase().endsWith('.svg')) {
      throw new BadRequestException('Editing SVG images is not supported');
    }

    // check that crop parameters will not go out of bounds
    const { width: assetWidth, height: assetHeight } = getDimensions(asset);

    if (!assetWidth || !assetHeight) {
      throw new BadRequestException('Asset dimensions are not available for editing');
    }

    const edits = dto.edits as AssetEditActionItem[];
    const crop = edits.find((e) => e.action === AssetEditAction.Crop);
    if (crop) {
      if (edits[0].action !== AssetEditAction.Crop) {
        throw new BadRequestException('Crop action must be the first edit action');
      }

      // check that crop parameters will not go out of bounds
      const { width: assetWidth, height: assetHeight } = getDimensions(asset);

View on GitHub (pinned to 199723261c)

Solutions

  1. Disable the editor for assets whose path/filename ends in .svg (case-insensitive).
  2. Rasterize the SVG to PNG before editing if pixel transforms are genuinely needed.

Example fix

// before
const editable = asset.type === 'IMAGE';

// after
const path = (asset.originalPath ?? asset.originalFileName ?? '').toLowerCase();
const editable = asset.type === 'IMAGE' && !path.endsWith('.svg');
Defensive patterns

Strategy: validation

Validate before calling

const path = (asset.originalPath ?? asset.originalFileName ?? '').toLowerCase();
if (path.endsWith('.svg')) {
  throw new Error('SVG assets cannot be edited.');
}
await api.put(`/assets/${asset.id}/edits`, { edits });

Type guard

const isSvg = (a: { originalPath?: string; originalFileName?: string }): boolean =>
  (a?.originalPath ?? a?.originalFileName ?? '').toLowerCase().endsWith('.svg');

Prevention

When it happens

Trigger: PUT /assets/{id}/edits on an asset whose stored originalPath has a .svg extension.

Common situations: SVG icons/illustrations imported as assets; client does not filter vector formats before enabling editing.

Related errors


AI-assisted analysis of immich-app/immich@199723261c (2026-08-12). Data as JSON: /api/errors/bbf784d80e112b6a. Report an issue: GitHub.