{"record":{"id":"c412ed775b708781","repo":"withastro/astro","slug":"unsupportedimageformat","errorCode":"UnsupportedImageFormat","errorMessage":"Received unsupported format `${format}` from `${imagePath}`. Currently only ${supportedFormats.join(', ')} are supported by our image services.","messagePattern":"Received unsupported format `(.+?)` from `(.+?)`\\. Currently only (.+?) are supported by our image services\\.","errorType":"exception","errorClass":"AstroError","httpStatus":null,"severity":"error","filePath":"packages/astro/src/assets/services/service.ts","lineNumber":188,"sourceCode":"\t\t// For remote images, width and height are explicitly required as we can't infer them from the file\n\t\tlet missingDimension: 'width' | 'height' | 'both' | undefined;\n\t\tif (!options.width && !options.height) {\n\t\t\tmissingDimension = 'both';\n\t\t} else if (!options.width && options.height) {\n\t\t\tmissingDimension = 'width';\n\t\t} else if (options.width && !options.height) {\n\t\t\tmissingDimension = 'height';\n\t\t}\n\n\t\tif (missingDimension) {\n\t\t\tthrow new AstroError({\n\t\t\t\t...AstroErrorData.MissingImageDimension,\n\t\t\t\tmessage: AstroErrorData.MissingImageDimension.message(missingDimension, options.src),\n\t\t\t});\n\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}","sourceCodeStart":170,"sourceCodeEnd":206,"githubUrl":"https://github.com/withastro/astro/blob/d081033d5fe8e8a68c4bbbad4af9d2deb9c74bca/packages/astro/src/assets/services/service.ts#L170-L206","documentation":"Thrown by verifyOptions() for ESM-imported images when the imported asset's format is not in VALID_SUPPORTED_FORMATS (jpeg, jpg, png, tiff, webp, gif, svg, avif). The format comes from the import metadata, so this rejects imports of unsupported image types like .bmp, .ico, .heic.","triggerScenarios":"Importing an ESM asset whose format (options.src.format) is not in the supported list and then passing it to Image/getImage. The offending format and the asset's src, plus the supported list, are interpolated into the message.","commonSituations":"Author imports a .bmp, .ico, .heif, or .raw file as an image asset; or an asset's detected format is undefined/unrecognized by the import pipeline.","solutions":["Convert the source image to a supported format (png, jpg, webp, avif, gif, tiff, or svg).","For static pass-through of vector content, use svg.","Re-export the asset in a supported container if the source is unusual.","Confirm the import pipeline correctly detected format; if undefined, the file may be corrupt."],"exampleFix":"// before\nimport logo from './logo.ico';\n\n// after - convert logo.ico to logo.svg or logo.png first\nimport logo from './logo.svg';","handlingStrategy":"validation","validationCode":"const SUPPORTED = new Set(['jpeg','jpg','png','tiff','webp','gif','svg','avif']);\nfunction isSupportedFormat(fmt: string): boolean { return SUPPORTED.has(fmt.toLowerCase()); }","typeGuard":"type SupportedFormat = 'jpeg'|'jpg'|'png'|'tiff'|'webp'|'gif'|'svg'|'avif';\nfunction isSupportedFormat(fmt: string): fmt is SupportedFormat {\n  return new Set(['jpeg','jpg','png','tiff','webp','gif','svg','avif']).has(fmt.toLowerCase());\n}","tryCatchPattern":null,"preventionTips":["Standardize on supported image formats for asset imports.","Convert exotic formats (bmp/ico/heic) to png/webp before importing.","Confirm the import pipeline detected the format; corrupt files may report undefined."],"tags":["images","esm","formats","validation"],"backgroundTag":null,"analyzedSha":"d081033d5fe8e8a68c4bbbad4af9d2deb9c74bca","analyzedAt":"2026-08-12T13:37:29.035Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}