parcel-bundler/parcel · error · Error

The image transformer does not support ${asset.type} images.

Error message

The image transformer does not support ${asset.type} images.

What it means

Thrown by @parcel/transformer-image when the input asset's type is not in the FORMATS map (jpeg/jpg/png/webp/gif/tiff/avif/heic/heif). The image transformer only processes raster formats Sharp supports; any other asset type routed to it bails here.

Source

Thrown at packages/transformers/image/src/ImageTransformer.js:43

    let configFile: any = await config.getConfig(
      ['sharp.config.json'], // '.sharprc', '.sharprc.json'
      {packageKey: 'sharp'},
    );

    if (configFile?.contents) {
      validateConfig(configFile.contents, configFile.filePath);
      return configFile.contents;
    } else {
      return {};
    }
  },

  async transform({config, asset, options}) {
    asset.bundleBehavior = 'isolated';

    const originalFormat = FORMATS.get(asset.type);
    if (!originalFormat) {
      throw new Error(
        `The image transformer does not support ${asset.type} images.`,
      );
    }

    const width = asset.query.has('width')
      ? parseInt(asset.query.get('width'), 10)
      : null;
    const height = asset.query.has('height')
      ? parseInt(asset.query.get('height'), 10)
      : null;
    const quality = asset.query.has('quality')
      ? parseInt(asset.query.get('quality'), 10)
      : config.quality;
    let targetFormat = asset.query.get('as')?.toLowerCase().trim();
    if (targetFormat && !FORMATS.has(targetFormat)) {
      throw new Error(
        `The image transformer does not support ${targetFormat} images.`,
      );

View on GitHub (pinned to 59484858a1)

Solutions

  1. Verify the file is a supported raster format (png/jpeg/webp/gif/tiff/avif/heic/heif).
  2. For SVG, use the SVG transformer or an SVG-aware pipeline; do not route it through @parcel/transformer-image.
  3. If you genuinely need a new format, pre-convert the asset to a supported one or write a transformer that converts the asset.type before this transformer runs.
  4. Audit .parcelrc for a custom `*.{ico,bmp}` -> @parcel/transformer-image mapping and remove it.
Defensive patterns

Strategy: type-guard

Validate before calling

const SUPPORTED_INPUT = new Set(['jpeg','jpg','png','webp','gif','tiff','avif','heic','heif']);
function isSupportedImageType(type) {
  return SUPPORTED_INPUT.has(type);
}

Type guard

function isSupportedImageAsset(asset) {
  return ['jpeg','jpg','png','webp','gif','tiff','avif','heic','heif'].includes(asset.type);
}

Prevention

When it happens

Trigger: An asset whose extension is not in the supported list reaches this transformer's transform() (e.g. .svg, .bmp, .ico, .jfif). The check uses asset.type, which is the Parcel asset type derived from the file extension or a prior transformer.

Common situations: Trying to resize/convert an SVG with the image transformer (SVG is handled by a different transformer); configuring .parcelrc to route .ico/.bmp/etc. to @parcel/transformer-image; misconfigured asset pipeline sending unsupported raster formats.

Related errors


AI-assisted analysis of parcel-bundler/parcel@59484858a1 (2026-08-13). Data as JSON: /api/errors/627a61e37d46a5db. Report an issue: GitHub.