{"record":{"id":"902a150456e7836a","repo":"BabylonJS/Babylon.js","slug":"exrloader-parse-file-contains-unsupported-data-ch","errorCode":null,"errorMessage":"EXRLoader.parse: file contains unsupported data channels.","messagePattern":"EXRLoader\\.parse: file contains unsupported data channels\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/dev/core/src/Materials/Textures/Loaders/EXR/exrLoader.decoder.ts","lineNumber":199,"sourceCode":"    if (channels.R && channels.G && channels.B && channels.A) {\r\n        decoder.outputChannels = 4;\r\n        decoder.decodeChannels = { R: 0, G: 1, B: 2, A: 3 };\r\n    } else if (channels.R && channels.G && channels.B) {\r\n        fillAlpha = true;\r\n        decoder.outputChannels = 4;\r\n        decoder.decodeChannels = { R: 0, G: 1, B: 2, A: 3 };\r\n    } else if (channels.R && channels.G) {\r\n        decoder.outputChannels = 2;\r\n        decoder.decodeChannels = { R: 0, G: 1 };\r\n    } else if (channels.R) {\r\n        decoder.outputChannels = 1;\r\n        decoder.decodeChannels = { R: 0 };\r\n    } else if (channels.Y) {\r\n        decoder.outputChannels = 1;\r\n        decoder.decodeChannels = { Y: 0 };\r\n        // Note: Supporting 'Y' channel for legacy compatibility; prefer 'R' in new EXRs.\r\n    } else {\r\n        throw new Error(\"EXRLoader.parse: file contains unsupported data channels.\");\r\n    }\r\n\r\n    if (decoder.type === 1) {\r\n        // half\r\n        switch (outputType) {\r\n            case EXROutputType.Float:\r\n                decoder.getter = ParseFloat16;\r\n                decoder.inputSize = INT16_SIZE;\r\n                break;\r\n\r\n            case EXROutputType.HalfFloat:\r\n                decoder.getter = ParseUint16;\r\n                decoder.inputSize = INT16_SIZE;\r\n                break;\r\n        }\r\n    } else if (decoder.type === 2) {\r\n        // float\r\n        switch (outputType) {\r","sourceCodeStart":181,"sourceCodeEnd":217,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/core/src/Materials/Textures/Loaders/EXR/exrLoader.decoder.ts#L181-L217","documentation":"After scanning the header's channel list, the decoder must find R, G, B, A or Y to decode. If the file's only recognized channels are none of these (e.g. only Z/depth, custom AOV channels, or channels whose names the switch ignores), it throws because it cannot map any channel to output pixels.","triggerScenarios":"Raised in CreateDecoderAsync when header.channels contains no R/G/B/A/Y channel — e.g. a single-channel depth pass stored as 'Z' or 'depth.Y' with no Y/R channel, or a data/AOV EXR with only custom named channels.","commonSituations":"Loading depth-only or AOV render passes intended for compositors, custom CryEngine/prop channels, or mistyped channel names from a custom exporter.","solutions":["Re-export the texture so it contains R/G/B (or at least Y or R) channels","Rename the primary channel to R or Y in the exporter settings","Use a converter (oiiotool) to add RGB channels: `oiiotool depth.exr -ch R=Z,G=Z,B=Z -o rgb.exr`","Verify with exrheader -info which channels the file actually holds"],"exampleFix":"// before: EXR with only a 'Z' depth channel\n// after: convert so the channel is named R\n// oiiotool depth.exr -ch R=Z -o single.exr","handlingStrategy":"validation","validationCode":"// parse channel names from the EXR header before loading, or check with the export pipeline\n// quick client-side guard: ensure the asset was exported as RGB/RGBA/Y, not a depth/AOV pass\nif (isDepthOrAovPass(assetMeta)) throw new Error(\"use an RGB/RGBA EXR for textures\");","typeGuard":"function isDecodableExrChannel(name: string): boolean {\n  return [\"R\", \"G\", \"B\", \"A\", \"Y\"].includes(name);\n}","tryCatchPattern":"try {\n  await loader.loadAsync(file);\n} catch (e) {\n  if (/unsupported data channels/.test(String(e))) {\n    console.warn(\"EXR has no R/G/B/A/Y channels (depth/AOV pass?) — converting\");\n    return loadConvertedTexture(url);\n  }\n  throw e;\n}","preventionTips":["Export textures as RGB/RGBA, not depth or AOV passes","Rename custom primary channels to R or Y at export","Document which passes are texture-loadable in your asset pipeline","Inspect channel names with exrheader -info before shipping"],"tags":["exr","channels","unsupported-format"],"backgroundTag":"unsupported-exr-channel-layout","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}