{"record":{"id":"1e731911bba27f94","repo":"SixLabors/ImageSharp","slug":"not-supported-decoder-compression-method-compressiontype","errorCode":null,"errorMessage":"Not supported decoder compression method: {compressionType}","messagePattern":"Not supported decoder compression method: (.+?)","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"src/ImageSharp/Formats/Exr/ExrThrowHelper.cs","lineNumber":14,"sourceCode":"// Copyright (c) Six Labors.\n// Licensed under the Six Labors Split License.\n\nusing System.Diagnostics.CodeAnalysis;\n\nnamespace SixLabors.ImageSharp.Formats.Exr;\n\n/// <summary>\n/// Cold path optimizations for throwing exr format based exceptions.\n/// </summary>\ninternal static class ExrThrowHelper\n{\n    [DoesNotReturn]\n    public static Exception NotSupportedDecompressor(string compressionType) => throw new NotSupportedException($\"Not supported decoder compression method: {compressionType}\");\n\n    [DoesNotReturn]\n    public static void ThrowInvalidImageContentException(string errorMessage) => throw new InvalidImageContentException(errorMessage);\n\n    [DoesNotReturn]\n    public static void ThrowNotSupportedVersion() => throw new NotSupportedException(\"Unsupported EXR version\");\n\n    [DoesNotReturn]\n    public static void ThrowNotSupported(string msg) => throw new NotSupportedException(msg);\n\n    [DoesNotReturn]\n    public static void ThrowInvalidImageHeader() => throw new InvalidImageContentException(\"Invalid EXR image header\");\n\n    [DoesNotReturn]\n    public static void ThrowInvalidImageHeader(string msg) => throw new InvalidImageContentException(msg);\n\n    [DoesNotReturn]\n    public static Exception NotSupportedCompressor(string compressionType) => throw new NotSupportedException($\"Not supported encoder compression method: {compressionType}\");","sourceCodeStart":1,"sourceCodeEnd":32,"githubUrl":"https://github.com/SixLabors/ImageSharp/blob/59ce6af6fc29027cda277ef62d4d1694a8acce91/src/ImageSharp/Formats/Exr/ExrThrowHelper.cs#L1-L32","documentation":"Thrown when decoding an EXR file whose compression method is not supported by the decoder. EXR supports several compression types (None, RLE, ZIP, PIZ, etc.); files written with a method this decoder does not implement cannot be decompressed. This is a NotSupportedException signaling an unimplemented code path, not data corruption.","triggerScenarios":"Image.Load / DecodeAsync on an EXR file whose version/header declares an unsupported compressionType (e.g. B44/B44A/DWA on decoders lacking them, or a corrupted/invalid compression byte).","commonSituations":"Receiving EXR files from renderers or tools (e.g. DWAA/DWB from newer OpenEXR versions) that use compression methods newer than the ImageSharp EXR decoder supports; mixing EXR writer/decoder versions.","solutions":["Re-export the EXR with a supported compression method (None, RLE, ZIP, PIZ) using OpenEXR tooling or the originating application","Check the ImageSharp version and upgrade, since newer versions support more compression methods","Pre-convert the file with `exrmakepreview`/`exrheader` inspection + oiiotool conversion to an uncompressed EXR","If the byte is invalid, validate the source file is not truncated/corrupt"],"exampleFix":"// before\nvar image = Image.Load(path); // throws for unsupported compression\n// after\ntry { var image = Image.Load(path); }\ncatch (NotSupportedException) { Process.Start(\"oiiotool\", $\"{path} -d \\\".*\\\" -o converted.exr\"); var image = Image.Load(\"converted.exr\"); }","handlingStrategy":"try-catch","validationCode":"// Inspect EXR compression byte (offset 4 of the 8-byte version header)\nusing var fs = File.OpenRead(path);\nvar header = new byte[8];\nif (fs.Read(header, 0, 8) < 8) throw new InvalidDataException(\"Not EXR\");\nint compression = header[5] & 0x0F;\nbool supported = compression is 0 or 1 or 2 or 3 or 4; // None/RLE/Zips/Zip/Piz\n","typeGuard":null,"tryCatchPattern":"try { return Image.Load(stream); }\ncatch (NotSupportedException ex) when (ex.Message.StartsWith(\"Not supported decoder compression\")) { return ConvertWithExternalTool(stream); }","preventionTips":["Standardize EXR assets on None/RLE/ZIP/PIZ compression","Upgrade ImageSharp regularly for newer compression support","Run exrheader on third-party EXR files during ingest","Keep an oiiotool/magick fallback converter available"],"tags":["exr","decoder","compression","unsupported"],"backgroundTag":"unsupported-enum-value","analyzedSha":"59ce6af6fc29027cda277ef62d4d1694a8acce91","analyzedAt":"2026-09-13T18:34:59.331Z","contentChangedAt":"2026-09-13T18:34:59.331Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}