{"record":{"id":"61459ead2cf506cc","repo":"BabylonJS/Babylon.js","slug":"extensioncontext-invalid-area-light-type-li","errorCode":null,"errorMessage":"${extensionContext}: Invalid area light type (${light.type})","messagePattern":"(.+?): Invalid area light type \\((.+?)\\)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/dev/loaders/src/glTF/2.0/Extensions/EXT_lights_area.pure.ts","lineNumber":95,"sourceCode":"                switch (light.type) {\r\n                    case EXTLightsArea_LightType.RECT: {\r\n                        const width = light.rect?.aspect !== undefined ? light.rect.aspect * size : size;\r\n                        const height = size;\r\n                        const babylonRectAreaLight = new RectAreaLight(name, Vector3.Zero(), width, height, this._loader.babylonScene);\r\n                        babylonLight = babylonRectAreaLight;\r\n                        break;\r\n                    }\r\n                    case EXTLightsArea_LightType.DISK: {\r\n                        // For disk lights, we'll use a rectangle light with the same area to approximate the disk light\r\n                        // In the future, this could be extended to support actual disk area lights\r\n                        const newSize = Math.sqrt(size * size * 0.25 * Math.PI); // Area of the disk\r\n                        const babylonRectAreaLight = new RectAreaLight(name, Vector3.Zero(), newSize, newSize, this._loader.babylonScene);\r\n                        babylonLight = babylonRectAreaLight;\r\n                        break;\r\n                    }\r\n                    default: {\r\n                        this._loader.babylonScene._blockEntityCollection = false;\r\n                        throw new Error(`${extensionContext}: Invalid area light type (${light.type})`);\r\n                    }\r\n                }\r\n\r\n                babylonLight._parentContainer = this._loader._assetContainer;\r\n                this._loader.babylonScene._blockEntityCollection = false;\r\n                light._babylonLight = babylonLight;\r\n\r\n                babylonLight.falloffType = Light.FALLOFF_GLTF;\r\n                babylonLight.diffuse = light.color ? Color3.FromArray(light.color) : Color3.White();\r\n                babylonLight.intensity = light.intensity == undefined ? 1 : light.intensity;\r\n\r\n                // glTF EXT_lights_area specifies lights face down -Z, but Babylon.js area lights face down +Z\r\n                // Create a parent transform node with 180-degree rotation around Y axis to flip the direction\r\n                const lightParentNode = new BabylonTransformNode(`${name}_orientation`, this._loader.babylonScene);\r\n                lightParentNode.rotationQuaternion = Quaternion.RotationAxis(Vector3.Up(), Math.PI);\r\n                lightParentNode.parent = babylonMesh;\r\n                babylonLight.parent = lightParentNode;\r\n\r","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/loaders/src/glTF/2.0/Extensions/EXT_lights_area.pure.ts#L77-L113","documentation":"The EXT_lights_area glTF extension loader throws this when a KHR/EXT area light declares a type other than the supported ones (e.g. only 'rectangle' is supported, mapped to RectAreaLight). An unknown light.type string falls into the default branch and aborts node loading.","triggerScenarios":"Loading a glTF 2.0 asset whose EXT_lights_video/area extension node has light.type set to something other than 'rectangle' (e.g. 'disc', 'sphere', or a typo like 'rect').","commonSituations":"Assets exported by tools writing newer/unofficial area light variants; hand-edited glTF changing the type string; mismatch between exporter extension version and loader support.","solutions":["Change the light type in the glTF to 'rectangle' (the only supported type)","Remove the area light extension entry or the node if the light is not essential","Re-export with a tool version aligned to the rectangle-only support","Patch the asset JSON: replace the unsupported type value"],"exampleFix":"// before (asset glTF)\n\"lights\": [{ \"type\": \"sphere\", ... }]\n// after\n\"lights\": [{ \"type\": \"rectangle\", ... }]","handlingStrategy":"validation","validationCode":"const light = node.extensions?.EXT_lights_video?.lights?.[i];\nif (light && light.type !== 'rectangle') {\n  throw new Error(`Unsupported area light type: ${light.type}`);\n}","typeGuard":"function isSupportedAreaLight(l: { type: string }): boolean {\n  return l.type === 'rectangle';\n}","tryCatchPattern":"try {\n  await BABYLON.SceneLoader.LoadAsync('./', 'scene.gltf', engine);\n} catch (e) {\n  if (e instanceof Error && e.message.includes('Invalid area light type')) {\n    console.error('Convert area lights to rectangle type or strip the extension');\n  } else throw e;\n}","preventionTips":["Restrict exporter light types to rectangles","Pre-scan asset JSON for EXT area light types before load","Keep exporter and loader versions in sync"],"tags":["gltf","extension","light","unsupported-value"],"backgroundTag":"unsupported-extension-value","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}