{"record":{"id":"87d02b155261a0b1","repo":"SixLabors/ImageSharp","slug":"unsupported-exr-version","errorCode":null,"errorMessage":"Unsupported EXR version","messagePattern":"Unsupported EXR version","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"src/ImageSharp/Formats/Exr/ExrThrowHelper.cs","lineNumber":20,"sourceCode":"// 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}\");\n}\n","sourceCodeStart":2,"sourceCodeEnd":34,"githubUrl":"https://github.com/SixLabors/ImageSharp/blob/59ce6af6fc29027cda277ef62d4d1694a8acce91/src/ImageSharp/Formats/Exr/ExrThrowHelper.cs#L2-L34","documentation":"Thrown when an EXR file's version field is unsupported. The EXR header version number encodes format version and flags (single-part, tiled, multi-part, deep); this decoder only supports certain versions/layouts. Files with unknown or unsupported version flags cannot be read.","triggerScenarios":"Image.Load/Decode on an EXR whose version byte is not a supported version (e.g. deep data or a future format version, or a corrupted header byte).","commonSituations":"Reading EXR files produced by very new OpenEXR writers using deep/tiled multi-part extensions, or reading truncated files where the version byte is garbage.","solutions":["Re-export the EXR as a single-part scanline file with a supported version (oiiotool input.exr -o output.exr)","Upgrade ImageSharp to a version with broader EXR version support","Verify the file is a complete, valid EXR (exrheader) rather than truncated/corrupt"],"exampleFix":"// before\nvar image = Image.Load(exrStream);\n// after\nusing var fs = File.OpenRead(path);\nbyte[] head = new byte[8]; fs.Read(head, 0, 8);\nif (head[4] > 2 || (head[5] & 0x10) != 0) // version > 2 or deep-data flag\n    ConvertToScanlineExr(path);\nvar image = Image.Load(path);","handlingStrategy":"try-catch","validationCode":"// Check EXR version byte before decode\nusing var fs = File.OpenRead(path);\nvar header = new byte[8];\nif (fs.Read(header, 0, 8) < 8) throw new InvalidDataException(\"Not EXR\");\nif (header[4] > 2 || (header[5] & 0x10) != 0) throw new NotSupportedException(\"Deep/multipart EXR not supported\");\n","typeGuard":null,"tryCatchPattern":"try { return Image.Load(stream); }\ncatch (NotSupportedException ex) when (ex.Message == \"Unsupported EXR version\") { return ConvertToScanlineExr(stream); }","preventionTips":["Export EXRs as single-part scanline files for maximum compatibility","Avoid deep-data and tiled multi-part EXRs in interchange pipelines","Pin writers to OpenEXR output settings compatible with your decoder","Validate EXR headers during ingest"],"tags":["exr","decoder","version","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"}