{"record":{"id":"4e9ee8850a057bd9","repo":"parcel-bundler/parcel","slug":"the-image-transformer-does-not-support-targetfor","errorCode":null,"errorMessage":"The image transformer does not support ${targetFormat} images.","messagePattern":"The image transformer does not support (.+?) images\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/transformers/image/src/ImageTransformer.js","lineNumber":59,"sourceCode":"    const originalFormat = FORMATS.get(asset.type);\n    if (!originalFormat) {\n      throw new Error(\n        `The image transformer does not support ${asset.type} images.`,\n      );\n    }\n\n    const width = asset.query.has('width')\n      ? parseInt(asset.query.get('width'), 10)\n      : null;\n    const height = asset.query.has('height')\n      ? parseInt(asset.query.get('height'), 10)\n      : null;\n    const quality = asset.query.has('quality')\n      ? parseInt(asset.query.get('quality'), 10)\n      : config.quality;\n    let targetFormat = asset.query.get('as')?.toLowerCase().trim();\n    if (targetFormat && !FORMATS.has(targetFormat)) {\n      throw new Error(\n        `The image transformer does not support ${targetFormat} images.`,\n      );\n    }\n\n    const format = nullthrows(FORMATS.get(targetFormat || originalFormat));\n    const outputOptions = config[format];\n\n    if (width || height || quality || targetFormat || outputOptions) {\n      // Sharp must be required from the main thread as well to prevent errors when workers exit\n      // See https://sharp.pixelplumbing.com/install#worker-threads and https://github.com/lovell/sharp/issues/2263\n      if (WorkerFarm.isWorker() && !isSharpLoadedOnMainThread) {\n        let api = WorkerFarm.getWorkerApi();\n        await api.callMaster({\n          location: __dirname + '/loadSharp.js',\n          args: [\n            options.packageManager,\n            asset.filePath,\n            options.shouldAutoInstall,","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/parcel-bundler/parcel/blob/59484858a1a0bcbb71f74088956bb437a2db6505/packages/transformers/image/src/ImageTransformer.js#L41-L77","documentation":"Thrown by @parcel/transformer-image when the `as` query parameter requests a target format not in the FORMATS map. Distinct from 128 (which is the input format): this fires only when the developer explicitly asks for a conversion target via `?as=...` that Parcel/Sharp does not support.","triggerScenarios":"Importing an image with a query like `./logo.png?as=ico` or `?as=bmp` where the requested type is not in FORMATS. targetFormat is lowercased and trimmed before the check.","commonSituations":"Migrating from a custom webpack image loader that supported formats Parcel does not; requesting .ico output for favicons; typos in the `as` query (`?as=jpe`).","solutions":["Use a supported target format: jpeg/jpg/png/webp/gif/tiff/avif/heic/heif.","For favicon .ico generation, add a separate build step (e.g. realfavicongenerator) rather than the image transformer.","Check for typos in the `as` query value."],"exampleFix":"// before\nimport logo from './logo.png?as=ico';\n// after\nimport logo from './logo.png?as=png';\n// (generate .ico separately outside Parcel)","handlingStrategy":"validation","validationCode":"const SUPPORTED = new Set(['jpeg','jpg','png','webp','gif','tiff','avif','heic','heif']);\nfunction validateAsQuery(queryString) {\n  const params = new URLSearchParams(queryString);\n  const as = params.get('as');\n  if (as && !SUPPORTED.has(as.toLowerCase().trim())) {\n    throw new Error(`?as=${as} not supported; use one of: ${[...SUPPORTED].join(', ')}`);\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Standardize on a small list of target formats for image queries in your project.","Generate favicons (.ico) outside Parcel."],"tags":["image","sharp","query-param","unsupported-format"],"backgroundTag":null,"analyzedSha":"59484858a1a0bcbb71f74088956bb437a2db6505","analyzedAt":"2026-08-13T04:06:35.925Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}