{"record":{"id":"2013359c136fb625","repo":"BabylonJS/Babylon.js","slug":"exr-data-could-not-be-decoded","errorCode":null,"errorMessage":"EXR data could not be decoded.","messagePattern":"EXR data could not be decoded\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/dev/core/src/Materials/Textures/exrCubeTexture.pure.ts","lineNumber":67,"sourceCode":"    /**\r\n     * Get the current class name of the texture useful for serialization or dynamic coding.\r\n     * @returns \"EXRCubeTexture\"\r\n     */\r\n    public override getClassName(): string {\r\n        return \"EXRCubeTexture\";\r\n    }\r\n\r\n    /**\r\n     * Convert the raw data from the server into cubemap faces\r\n     * @param buffer The buffer containing the texture data\r\n     * @param size The cubemap face size\r\n     * @param supersample Defines if texture must be supersampled\r\n     * @returns The cube map data\r\n     */\r\n    protected async _getCubeMapTextureDataAsync(buffer: ArrayBuffer, size: number, supersample: boolean): Promise<CubeMapInfo> {\r\n        const exrData = await ReadExrDataAsync(buffer);\r\n        if (!exrData.data) {\r\n            throw new Error(\"EXR data could not be decoded.\");\r\n        }\r\n\r\n        const cubeMapData = PanoramaToCubeMapTools.ConvertPanoramaToCubemap(exrData.data, exrData.width, exrData.height, size, supersample, false);\r\n        return cubeMapData;\r\n    }\r\n\r\n    protected _instantiateClone(): this {\r\n        return new EXRCubeTexture(this.url, this.getScene() || this._getEngine()!, this._size, this._noMipmap, this._generateHarmonics, this.gammaSpace) as this;\r\n    }\r\n\r\n    /**\r\n     * Serialize the texture to a JSON representation.\r\n     * @returns The JSON representation of the texture\r\n     */\r\n    public override serialize(): any {\r\n        const serializationObject = super.serialize();\r\n        if (!serializationObject) {\r\n            return null;\r","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/core/src/Materials/Textures/exrCubeTexture.pure.ts#L49-L85","documentation":"_getCubeMapTextureDataAsync decodes an EXR panorama buffer with ReadExrDataAsync and then converts it to a cubemap. If decoding produces no pixel data (exrData.data is falsy), the library throws rather than passing garbage into PanoramaToCubeMapTools.","triggerScenarios":"Calling new EXRCubeTexture(url, scene, ...) where the downloaded buffer is not a decodable EXR file (corrupt file, truncated download, wrong file served, or an EXR variant the decoder does not support).","commonSituations":"Server returns an HTML error page or JSON with 200 status instead of EXR data, file saved with .exr extension but is actually a different format, or an unsupported EXR compression method.","solutions":["Verify the URL actually serves a valid EXR file (check magic bytes 0x76 0x2f 0x31 0x01)","Re-download or re-export the EXR file, e.g. from Blender/3ds Max with standard (non-exotic) compression","Check that the server is not returning an error page with a 200 status","Try a known-good EXR to isolate file vs code"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"async function isExr(url) {\n  const buf = new Uint8Array(await (await fetch(url)).arrayBuffer());\n  return buf[0] === 0x76 && buf[1] === 0x2f && buf[2] === 0x31 && buf[3] === 0x01;\n}","typeGuard":"function looksLikeExr(b: Uint8Array): boolean {\n  return b.length > 4 && b[0] === 0x76 && b[1] === 0x2f && b[2] === 0x31 && b[3] === 0x01;\n}","tryCatchPattern":"try {\n  const tex = new EXRCubeTexture(url, scene, 128);\n} catch (e) {\n  if (e instanceof Error && e.message.includes(\"EXR data could not be decoded\")) {\n    console.error(`Invalid EXR at ${url}, falling back`);\n    tex = fallbackTexture;\n  } else throw e;\n}","preventionTips":["Verify EXR magic bytes before decoding","Re-export EXRs with standard compression from trusted tools","Check network responses are the binary file, not error pages"],"tags":["texture","exr","decoding","asset-corruption"],"backgroundTag":"asset-decode-failed","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}