{"record":{"id":"bbf784d80e112b6a","repo":"immich-app/immich","slug":"editing-svg-images-is-not-supported","errorCode":null,"errorMessage":"Editing SVG images is not supported","messagePattern":"Editing SVG images is not supported","errorType":"exception","errorClass":"BadRequestException","httpStatus":400,"severity":"error","filePath":"server/src/services/asset.service.ts","lineNumber":557,"sourceCode":"\n    if (asset.type !== AssetType.Image) {\n      throw new BadRequestException('Only images can be edited');\n    }\n\n    if (asset.livePhotoVideoId) {\n      throw new BadRequestException('Editing live photos is not supported');\n    }\n\n    if (isPanorama(asset)) {\n      throw new BadRequestException('Editing panorama images is not supported');\n    }\n\n    if (asset.originalPath?.toLowerCase().endsWith('.gif')) {\n      throw new BadRequestException('Editing GIF images is not supported');\n    }\n\n    if (asset.originalPath?.toLowerCase().endsWith('.svg')) {\n      throw new BadRequestException('Editing SVG images is not supported');\n    }\n\n    // check that crop parameters will not go out of bounds\n    const { width: assetWidth, height: assetHeight } = getDimensions(asset);\n\n    if (!assetWidth || !assetHeight) {\n      throw new BadRequestException('Asset dimensions are not available for editing');\n    }\n\n    const edits = dto.edits as AssetEditActionItem[];\n    const crop = edits.find((e) => e.action === AssetEditAction.Crop);\n    if (crop) {\n      if (edits[0].action !== AssetEditAction.Crop) {\n        throw new BadRequestException('Crop action must be the first edit action');\n      }\n\n      // check that crop parameters will not go out of bounds\n      const { width: assetWidth, height: assetHeight } = getDimensions(asset);","sourceCodeStart":539,"sourceCodeEnd":575,"githubUrl":"https://github.com/immich-app/immich/blob/e55ac299a4ec7cb372e35dbf2c6c05ee9ce77f6c/server/src/services/asset.service.ts#L539-L575","documentation":"editAsset rejects SVG files: when asset.originalPath ends with '.svg' (case-insensitive), it throws BadRequestException('Editing SVG images is not supported'). Vector assets are outside the raster edit pipeline's supported inputs, so the edit is rejected before crop-bounds checks.","triggerScenarios":"Submitting crop/rotate/flip edits for an asset whose originalPath has an .svg extension — SVGs uploaded or synced into the library.","commonSituations":"Libraries synced from design tool exports or icon folders containing SVGs; bulk edit scripts that treat every IMAGE-type asset as raster; upload flows accepting SVGs without restricting later edits.","solutions":["Check originalPath/originalFileName for an .svg extension before submitting edits","Rasterize the SVG (e.g. to PNG at a target resolution) and upload that if an edit is required","Exclude SVG assets from edit-enabled UI surfaces","Catch the 400 and mark the asset as not editable"],"exampleFix":"// before\nawait applyEdits(svgAssetId, { rotate: 90 });\n// after\nif (asset.originalPath.toLowerCase().endsWith('.svg')) return skip('svg');\nawait applyEdits(svgAssetId, { rotate: 90 });","handlingStrategy":"validation","validationCode":"if (asset.originalPath?.toLowerCase().endsWith('.svg')) throw new Error(`Asset ${asset.id} is an SVG; editing not supported`);","typeGuard":"const isSvg = (a: { originalPath?: string | null }) => !!a.originalPath && a.originalPath.toLowerCase().endsWith('.svg');","tryCatchPattern":"try { await api.applyEdits(id, edits); } catch (e) { if (String(e?.response?.data?.message).includes('SVG')) { markUnsupported(id, 'svg'); return; } throw e; }","preventionTips":["Filter .svg assets out of edit-enabled surfaces","Rasterize SVGs to PNG/JPEG before uploading if edits are expected","Check both originalPath and originalFileName extensions","Treat the 400 SVG response as a permanent skip, not retryable"],"tags":["asset","edit","svg","unsupported-format"],"backgroundTag":"unsupported-operation","analyzedSha":"e55ac299a4ec7cb372e35dbf2c6c05ee9ce77f6c","analyzedAt":"2026-09-15T07:20:19.675Z","contentChangedAt":"2026-09-15T07:20:19.675Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}