{"record":{"id":"36665648e39eed97","repo":"BabylonJS/Babylon.js","slug":"unsupported-type-outputtype","errorCode":null,"errorMessage":"Unsupported type: ${outputType}","messagePattern":"Unsupported type: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/dev/core/src/Materials/Textures/Loaders/EXR/exrLoader.decoder.ts","lineNumber":263,"sourceCode":"            // Fill initially with 1s for the alpha value if the texture is not RGBA, RGB values will be overwritten\r\n            if (fillAlpha) {\r\n                decoder.byteArray.fill(1, 0, size);\r\n            }\r\n\r\n            break;\r\n\r\n        case EXROutputType.HalfFloat:\r\n            decoder.byteArray = new Uint16Array(size);\r\n            decoder.textureType = Constants.TEXTURETYPE_HALF_FLOAT;\r\n\r\n            if (fillAlpha) {\r\n                decoder.byteArray.fill(0x3c00, 0, size); // Uint16Array holds half float data, 0x3C00 is 1\r\n            }\r\n\r\n            break;\r\n\r\n        default:\r\n            throw new Error(\"Unsupported type: \" + outputType);\r\n    }\r\n\r\n    let byteOffset = 0;\r\n    for (const channel of header.channels) {\r\n        if (decoder.decodeChannels[channel.name] !== undefined) {\r\n            decoder.channelLineOffsets[channel.name] = byteOffset * decoder.width;\r\n        }\r\n\r\n        byteOffset += channel.pixelType * 2;\r\n    }\r\n\r\n    decoder.bytesPerLine = decoder.width * byteOffset;\r\n    decoder.outLineWidth = decoder.width * decoder.outputChannels;\r\n\r\n    if (header.lineOrder === \"INCREASING_Y\") {\r\n        decoder.scanOrder = (y) => y;\r\n    } else {\r\n        decoder.scanOrder = (y) => decoder.height - 1 - y;\r","sourceCodeStart":245,"sourceCodeEnd":281,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/core/src/Materials/Textures/Loaders/EXR/exrLoader.decoder.ts#L245-L281","documentation":"CreateDecoderAsync takes an outputType parameter (EXROutputType) selecting the destination texture format; only Float (Float32Array) and HalfFloat (Uint16Array) are handled. Any other value reaches the switch default and throws. This is a caller-supplied option, not file data.","triggerScenarios":"Raised in CreateDecoderAsync when the outputType argument passed through the EXR loading pipeline is neither EXROutputType.Float (0) nor EXROutputType.HalfFloat (1) — e.g. passing a raw number like 2, undefined, or a wrong enum from custom code.","commonSituations":"Custom loader integrations passing an invalid numeric type, typos mapping config values to EXROutputType, or stale code from an API version where the enum values changed.","solutions":["Pass EXROutputType.Float or EXROutputType.HalfFloat explicitly instead of a raw number","Log/inspect the outputType value reaching CreateDecoderAsync to find where it goes wrong","Ensure the enum import is from the same Babylon version as the loader","Default to EXROutputType.HalfFloat when the value is not one of the two valid members"],"exampleFix":"// before\nloader.load(url, { outputType: 2 as any });\n// after\nimport { EXROutputType } from \"...\";\nloader.load(url, { outputType: EXROutputType.Float });","handlingStrategy":"type-guard","validationCode":"import { EXROutputType } from \"@babylonjs/core\";\nfunction toOutputType(v: unknown): EXROutputType {\n  return v === EXROutputType.Float || v === EXROutputType.HalfFloat ? v : EXROutputType.HalfFloat;\n}","typeGuard":"function isEXROutputType(v: unknown): v is EXROutputType {\n  return v === 0 || v === 1; // EXROutputType.Float | EXROutputType.HalfFloat\n}","tryCatchPattern":"try {\n  await loader.loadAsync(file, { outputType });\n} catch (e) {\n  if (/Unsupported type/.test(String(e))) {\n    console.warn(\"bad outputType, retrying with HalfFloat\");\n    return loader.loadAsync(file, { outputType: EXROutputType.HalfFloat });\n  }\n  throw e;\n}","preventionTips":["Always use the EXROutputType enum, never raw numbers","Validate user/config-supplied format options before calling the loader","Keep enum imports from the same package version as the loader","Add a unit test asserting the option-mapping layer emits valid enum values"],"tags":["exr","invalid-argument","enum"],"backgroundTag":"invalid-output-type-argument","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}