{"record":{"id":"3465f49ee49b9dde","repo":"withastro/astro","slug":"unsupportedimageconversion","errorCode":"UnsupportedImageConversion","errorMessage":"Converting between vector (such as SVGs) and raster (such as PNGs and JPEGs) images is not currently supported.","messagePattern":"Converting between vector \\(such as SVGs\\) and raster \\(such as PNGs and JPEGs\\) images is not currently supported\\.","errorType":"exception","errorClass":"AstroError","httpStatus":null,"severity":"error","filePath":"packages/astro/src/assets/services/service.ts","lineNumber":203,"sourceCode":"\t\t}\n\t} else {\n\t\tif (!VALID_SUPPORTED_FORMATS.includes(options.src.format as any)) {\n\t\t\tthrow new AstroError({\n\t\t\t\t...AstroErrorData.UnsupportedImageFormat,\n\t\t\t\tmessage: AstroErrorData.UnsupportedImageFormat.message(\n\t\t\t\t\toptions.src.format,\n\t\t\t\t\toptions.src.src,\n\t\t\t\t\tVALID_SUPPORTED_FORMATS,\n\t\t\t\t),\n\t\t\t});\n\t\t}\n\n\t\tif (options.widths && options.densities) {\n\t\t\tthrow new AstroError(AstroErrorData.IncompatibleDescriptorOptions);\n\t\t}\n\n\t\tif (options.src.format !== 'svg' && options.format === 'svg') {\n\t\t\tthrow new AstroError(AstroErrorData.UnsupportedImageConversion);\n\t\t}\n\t}\n}\n\n/**\n * Basic local service using the included `_image` endpoint.\n * This service intentionally does not implement `transform`.\n *\n * Example usage:\n * ```ts\n * const service = {\n *  getURL: baseService.getURL,\n *  parseURL: baseService.parseURL,\n *  getHTMLAttributes: baseService.getHTMLAttributes,\n *  async transform(inputBuffer, transformOptions) {...}\n * }\n * ```\n *","sourceCodeStart":185,"sourceCodeEnd":221,"githubUrl":"https://github.com/withastro/astro/blob/d081033d5fe8e8a68c4bbbad4af9d2deb9c74bca/packages/astro/src/assets/services/service.ts#L185-L221","documentation":"Thrown by verifyOptions() when an ESM-imported raster source (src.format !== 'svg') is requested to be output as svg. Converting a raster image (png/jpg/etc.) into a vector SVG is not supported, so the guard rejects it with UnsupportedImageConversion.","triggerScenarios":"Passing format: 'svg' on an image whose imported src.format is not 'svg' (e.g. a jpg/png import with <Image format='svg' /> or getImage({ format: 'svg' })). The reverse (svg source rasterizing) is handled separately by sharp.","commonSituations":"Author hard-codes format='svg' across a set of images that includes rasters, or copies a config from an SVG usage into a raster pipeline.","solutions":["Remove format: 'svg' for raster sources.","Set format to a raster output (webp, avif, png, jpg) for raster sources.","Only use format: 'svg' with SVG sources for pass-through.","Audit shared image components for a hardcoded format attribute."],"exampleFix":"// before\n<Image src={photoJpg} format='svg' />\n\n// after\n<Image src={photoJpg} format='webp' />","handlingStrategy":"validation","validationCode":"function canOutputSvg(srcFormat: string, outputFormat: string): boolean {\n  return !(srcFormat !== 'svg' && outputFormat === 'svg');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Do not set format='svg' on raster sources.","Audit shared components for a hardcoded format attribute.","Use format='svg' only with SVG sources."],"tags":["images","formats","svg","validation"],"backgroundTag":null,"analyzedSha":"d081033d5fe8e8a68c4bbbad4af9d2deb9c74bca","analyzedAt":"2026-08-12T13:37:29.035Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}