parcel-bundler/parcel · error · Error

The image transformer does not support ${targetFormat} image

Error message

The image transformer does not support ${targetFormat} images.

What it means

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.

Source

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

    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.`,
      );
    }

    const format = nullthrows(FORMATS.get(targetFormat || originalFormat));
    const outputOptions = config[format];

    if (width || height || quality || targetFormat || outputOptions) {
      // Sharp must be required from the main thread as well to prevent errors when workers exit
      // See https://sharp.pixelplumbing.com/install#worker-threads and https://github.com/lovell/sharp/issues/2263
      if (WorkerFarm.isWorker() && !isSharpLoadedOnMainThread) {
        let api = WorkerFarm.getWorkerApi();
        await api.callMaster({
          location: __dirname + '/loadSharp.js',
          args: [
            options.packageManager,
            asset.filePath,
            options.shouldAutoInstall,

View on GitHub (pinned to 59484858a1)

Solutions

  1. Use a supported target format: jpeg/jpg/png/webp/gif/tiff/avif/heic/heif.
  2. For favicon .ico generation, add a separate build step (e.g. realfavicongenerator) rather than the image transformer.
  3. Check for typos in the `as` query value.

Example fix

// before
import logo from './logo.png?as=ico';
// after
import logo from './logo.png?as=png';
// (generate .ico separately outside Parcel)
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED = new Set(['jpeg','jpg','png','webp','gif','tiff','avif','heic','heif']);
function validateAsQuery(queryString) {
  const params = new URLSearchParams(queryString);
  const as = params.get('as');
  if (as && !SUPPORTED.has(as.toLowerCase().trim())) {
    throw new Error(`?as=${as} not supported; use one of: ${[...SUPPORTED].join(', ')}`);
  }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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`).

Related errors


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