BabylonJS/Babylon.js · error · Error

${CompressionCodes[header.compression]} is unsupported

Error message

${CompressionCodes[header.compression]} is unsupported

What it means

CreateDecoderAsync switches on the EXR header's compression code. Only NO/RLE/ZIPS/ZIP/PIZ/PXR24 are implemented; anything else (e.g. B44, B44A, DWAA, DWBA) hits the default branch and throws with the compression's name. The loader simply does not support that compression method yet.

Source

Thrown at packages/dev/core/src/Materials/Textures/Loaders/EXR/exrLoader.decoder.ts:150

        case CompressionCodes.ZIP_COMPRESSION:
            decoder.lines = 16;
            decoder.uncompress = UncompressZIP;
            await Tools.LoadScriptAsync(ExrLoaderGlobalConfiguration.FFLATEUrl);
            break;

        case CompressionCodes.PIZ_COMPRESSION:
            decoder.lines = 32;
            decoder.uncompress = UncompressPIZ;
            break;

        case CompressionCodes.PXR24_COMPRESSION:
            decoder.lines = 16;
            decoder.uncompress = UncompressPXR;
            await Tools.LoadScriptAsync(ExrLoaderGlobalConfiguration.FFLATEUrl);
            break;

        default:
            throw new Error(CompressionCodes[header.compression] + " is unsupported");
    }

    decoder.scanlineBlockSize = decoder.lines;

    const channels: {
        [key: string]: boolean;
    } = {};
    for (const channel of header.channels) {
        switch (channel.name) {
            case "R":
            case "G":
            case "B":
            case "A":
                channels[channel.name] = true;
                decoder.type = channel.pixelType;
                break;
            case "Y":
                channels[channel.name] = true;

View on GitHub (pinned to 0592b347b8)

Solutions

  1. Re-export the EXR with ZIP, ZIPS, RLE, PIZ or PXR24 compression
  2. Convert the file with a tool (e.g. `oiiotool in.exr -d half -o --compression zip out.exr`) to a supported codec
  3. Update the Babylon.js package to the latest version in case the codec was added
  4. Check header.compression value with exrheader to know which codec the file uses

Example fix

// before (DWAA, unsupported)
// oiiotool scene.exr -o scene_dwaa.exr
// after: re-export with a supported compression
// oiiotool scene.exr --compression zip -o scene.exr
Defensive patterns

Strategy: fallback

Validate before calling

// detect compression code from header before loading: byte 8 of an EXR is compression
// only accept 0 (NO), 1 (RLE), 3 (ZIPS), 4 (ZIP), 5 (PIZ) or 7 (PXR24)
const dv = new DataView(buf);
const compression = dv.getUint8(8);
const supported = [0, 1, 3, 4, 5, 7];
if (!supported.includes(compression)) throw new Error("EXR compression " + compression + " unsupported, re-export with ZIP");

Type guard

function hasSupportedExrCompression(buf: ArrayBuffer): boolean {
  if (buf.byteLength < 9) return false;
  const c = new DataView(buf).getUint8(8);
  return [0, 1, 3, 4, 5, 7].includes(c);
}

Try / catch

try {
  await loader.loadAsync(file);
} catch (e) {
  if (/is unsupported$/.test(String(e)) && /COMPRESSION/.test(String(e))) {
    return loadTranscodedExr(url); // pre-converted ZIP version
  }
  throw e;
}

Prevention

When it happens

Trigger: Raised in CreateDecoderAsync (called by loadData) when header.compression maps to an unimplemented CompressionCodes entry — typically loading a modern EXR exported with DWAA/DWBA lossy compression or B44.

Common situations: Textures exported from recent DCC tools (Houdini, Nuke, ARNold) defaulting to DWAA; EXRs transcoded with lossy compression for size; older library versions lacking newer codecs.

Related errors


AI-assisted analysis of BabylonJS/Babylon.js@0592b347b8 (2026-08-30). Data as JSON: /api/errors/d872b6f1caa65dda. Report an issue: GitHub.