{"record":{"id":"b47fe5b84a6a6b72","repo":"SixLabors/ImageSharp","slug":"not-supported-encoder-compression-method-compressiontype","errorCode":null,"errorMessage":"Not supported encoder compression method: {compressionType}","messagePattern":"Not supported encoder compression method: (.+?)","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"src/ImageSharp/Formats/Exr/ExrThrowHelper.cs","lineNumber":32,"sourceCode":"    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}\");\n}\n","sourceCodeStart":14,"sourceCodeEnd":34,"githubUrl":"https://github.com/SixLabors/ImageSharp/blob/59ce6af6fc29027cda277ef62d4d1694a8acce91/src/ImageSharp/Formats/Exr/ExrThrowHelper.cs#L14-L34","documentation":"Thrown when encoding an image to EXR with a compression method the encoder does not support. Unlike the decoder twin, this is triggered by user configuration: the requested ExrCompression is not implemented for writing. It is a NotSupportedException surfaced from the encoder path.","triggerScenarios":"Setting ExrEncoder.Compression to a value not supported by the encoder (e.g. passing an enum value cast outside the valid range or a method not implemented for writing) and calling EncodeAsExr/SaveAsync with that options object.","commonSituations":"Configuration mistakes where an enum from a different API is cast into ExrCompression, or copying encoder options across library versions where valid values changed.","solutions":["Use a supported ExrCompression value (None, RLE, Zip, Piz) in the ExrEncoder options","Remove the explicit Compression setting to use the default","Check the enum value against the ImageSharp version's ExrCompression definition"],"exampleFix":"// before\nvar encoder = new ExrEncoder { Compression = (ExrCompression)42 }; // throws\n// after\nvar encoder = new ExrEncoder { Compression = ExrCompression.Zip };","handlingStrategy":"validation","validationCode":"// Only pass known-supported compressions to the encoder\nbool isSupported(ExrCompression c) => c is ExrCompression.None or ExrCompression.Rle or ExrCompression.Zip or ExrCompression.Piz;\nif (!isSupported(encoder.Compression)) encoder.Compression = ExrCompression.Zip;","typeGuard":null,"tryCatchPattern":"try { image.EncodeAsExr(stream, encoder); }\ncatch (NotSupportedException ex) when (ex.Message.StartsWith(\"Not supported encoder compression\")) { encoder.Compression = ExrCompression.None; image.EncodeAsExr(stream, encoder); }","preventionTips":["Never cast raw ints into ExrCompression","Only assign ExrCompression enum members from the same ImageSharp version","Keep encoder options in strongly-typed config, not user-supplied ints","Default to None/Zip unless a specific compression is required"],"tags":["exr","encoder","compression","config"],"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"}