{"record":{"id":"c8c6411f119c8029","repo":"BabylonJS/Babylon.js","slug":"framegraphvolumetriclightingtask-this-name-l","errorCode":null,"errorMessage":"FrameGraphVolumetricLightingTask \"${this.name}\": lightingVolumeMesh is empty","messagePattern":"FrameGraphVolumetricLightingTask \"(.+?)\": lightingVolumeMesh is empty","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/dev/core/src/FrameGraph/Tasks/PostProcesses/volumetricLightingTask.ts","lineNumber":240,"sourceCode":"    public override isReady() {\r\n        return (\r\n            this._renderLightingVolumeMaterial.isReady() &&\r\n            this._clearLightingVolumeTextureTask.isReady() &&\r\n            this._renderLightingVolumeMaterial.isReady() &&\r\n            this._blendLightingVolumeTask.isReady()\r\n        );\r\n    }\r\n\r\n    public override getClassName(): string {\r\n        return \"FrameGraphVolumetricLightingTask\";\r\n    }\r\n\r\n    public record(skipCreationOfDisabledPasses = false) {\r\n        if (this.targetTexture === undefined || this.depthTexture === undefined || this.camera === undefined || this.lightingVolumeMesh === undefined || this.light === undefined) {\r\n            throw new Error(`FrameGraphVolumetricLightingTask \"${this.name}\": targetTexture, depthTexture, camera, lightingVolumeMesh and light are required`);\r\n        }\r\n        if (!this.lightingVolumeMesh.meshes || this.lightingVolumeMesh.meshes.length === 0) {\r\n            throw new Error(`FrameGraphVolumetricLightingTask \"${this.name}\": lightingVolumeMesh is empty`);\r\n        }\r\n\r\n        this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture, this.targetTexture);\r\n\r\n        const textureManager = this._frameGraph.textureManager;\r\n\r\n        let lightingVolumeTexture = this.lightingVolumeTexture;\r\n        if (!lightingVolumeTexture) {\r\n            const targetTextureCreationOptions = textureManager.getTextureCreationOptions(this.targetTexture);\r\n\r\n            targetTextureCreationOptions.options.labels = [\"InScattering\"];\r\n            targetTextureCreationOptions.options.samples = 1;\r\n\r\n            lightingVolumeTexture = textureManager.createRenderTargetTexture(`${this.name} - lighting volume texture`, targetTextureCreationOptions);\r\n        }\r\n\r\n        this.lightingVolumeMesh.meshes[0].material = this._renderLightingVolumeMaterial;\r\n\r","sourceCodeStart":222,"sourceCodeEnd":258,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/core/src/FrameGraph/Tasks/PostProcesses/volumetricLightingTask.ts#L222-L258","documentation":"record() also validates that the lightingVolumeMesh input actually contains meshes. The FrameGraphMesh input exists (is not undefined) but its .meshes array is null or empty, so the task has nothing to render the lighting volume with and throws instead of recording a degenerate pass.","triggerScenarios":"Calling record() when this.lightingVolumeMesh.meshes is undefined or has length 0 — e.g. a mesh input created from an empty container, a mesh removed from the scene after the input was created, or an input handle bound to nothing.","commonSituations":"Passing an AssetContainer's meshes array after it was emptied/disposed; the volume mesh was disposed before frame graph build; filtering scene meshes produced an empty list; async mesh loading hadn't finished when the graph was built.","solutions":["Make sure the source mesh (e.g. a bounding-box/cone mesh for the light volume) exists and is added to the mesh input before record().","Check that the mesh wasn't disposed: verify mesh.isDisposed() === false and it's still in the scene.","If meshes load asynchronously, wait for load completion (e.g. onReady / await) before building the frame graph.","Validate input.meshes.length > 0 before calling record() and skip or error out gracefully otherwise."],"exampleFix":"// before\nconst meshInput = frameGraph.createMeshInputValue([]);\ntask.lightingVolumeMesh = meshInput;\ntask.record(); // throws: lightingVolumeMesh is empty\n\n// after\nconst volumeMesh = MeshBuilder.CreateBox(\"vol\", { size: 1 }, scene);\nconst meshInput = frameGraph.createMeshInputValue(volumeMesh);\ntask.lightingVolumeMesh = meshInput;\ntask.record();","handlingStrategy":"validation","validationCode":"if (!task.lightingVolumeMesh || !task.lightingVolumeMesh.meshes || task.lightingVolumeMesh.meshes.length === 0) {\n    throw new Error(\"lightingVolumeMesh input has no meshes\");\n}\ntask.record();","typeGuard":"function hasMeshes(input: { meshes?: unknown[] } | undefined): input is { meshes: unknown[] } {\n    return !!input && Array.isArray(input.meshes) && input.meshes.length > 0;\n}","tryCatchPattern":"try {\n    task.record();\n} catch (e) {\n    if ((e as Error).message.includes(\"lightingVolumeMesh is empty\")) {\n        console.error(\"Volume mesh empty or disposed; re-binding mesh input.\");\n        task.lightingVolumeMesh = frameGraph.createMeshInputValue(volumeMesh);\n        task.record();\n    } else throw e;\n}","preventionTips":["Bind the volume mesh only after it is created and added to the scene.","Don't dispose meshes referenced by frame graph inputs until the graph is torn down.","Wait for async mesh loading to finish before building the graph.","Assert input.meshes.length > 0 in dev builds before record()."],"tags":["babylonjs","frame-graph","empty-mesh","validation","record"],"backgroundTag":"missing-required-parameter","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}