{"record":{"id":"1fd00d646722f480","repo":"BabylonJS/Babylon.js","slug":"framegraphcascadedshadowgeneratortask-this-name-1fd00d","errorCode":null,"errorMessage":"FrameGraphCascadedShadowGeneratorTask ${this.name}: light, objectList and camera are required","messagePattern":"FrameGraphCascadedShadowGeneratorTask (.+?): light, objectList and camera are required","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/dev/core/src/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.ts","lineNumber":305,"sourceCode":"            shadowGenerator.stabilizeCascades = this._stabilizeCascades;\r\n            shadowGenerator.lambda = this._lambda;\r\n            shadowGenerator.cascadeBlendPercentage = this._cascadeBlendPercentage;\r\n            shadowGenerator.depthClamp = this._depthClamp;\r\n            shadowGenerator.shadowMaxZ = this._shadowMaxZ;\r\n\r\n            return true;\r\n        }\r\n\r\n        return false;\r\n    }\r\n\r\n    public override getClassName(): string {\r\n        return \"FrameGraphCascadedShadowGeneratorTask\";\r\n    }\r\n\r\n    public override record() {\r\n        if (this.light === undefined || this.objectList === undefined || this.camera === undefined) {\r\n            throw new Error(`FrameGraphCascadedShadowGeneratorTask ${this.name}: light, objectList and camera are required`);\r\n        }\r\n\r\n        if (this.depthTexture !== undefined) {\r\n            const depthTextureCreationOptions = this._frameGraph.textureManager.getTextureCreationOptions(this.depthTexture);\r\n\r\n            const size = !depthTextureCreationOptions.sizeIsPercentage\r\n                ? textureSizeIsObject(depthTextureCreationOptions.size)\r\n                    ? depthTextureCreationOptions.size\r\n                    : { width: depthTextureCreationOptions.size, height: depthTextureCreationOptions.size }\r\n                : this._frameGraph.textureManager.getAbsoluteDimensions(depthTextureCreationOptions.size);\r\n\r\n            const width = size.width;\r\n            const height = size.height;\r\n\r\n            depthTextureCreationOptions.sizeIsPercentage = false;\r\n            depthTextureCreationOptions.options.formats = [Constants.TEXTUREFORMAT_RG];\r\n            depthTextureCreationOptions.options.samples = 1;\r\n\r","sourceCodeStart":287,"sourceCodeEnd":323,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/core/src/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.ts#L287-L323","documentation":"FrameGraphCascadedShadowGeneratorTask.record() throws when the required inputs light, objectList, or camera are undefined. Like all frame graph tasks, the CSM shadow generator needs its light source, the list of shadow-casting/receiving objects, and the camera bound before the frame graph is recorded.","triggerScenarios":"Calling record()/frameGraph.build() before assigning task.light, task.objectList, or task.camera — e.g. omitting task.objectList = frameGraph.createObjectListInput(...) or forgetting the camera assignment.","commonSituations":"Setting up a CSM task from a template and dropping the objectList assignment; camera created late or swapped; objects list built from an empty/undefined array of meshes; refactoring that renamed a variable leaving an assignment pointing elsewhere.","solutions":["Assign all three before record(): task.light, task.objectList, and task.camera.","Create the object list via frameGraph.createObjectList with the meshes that should cast/receive shadows, then bind it to task.objectList.","Verify the light is a DirectionalLight (a later check in _createShadowGeneratorInstance also requires it).","Move all task configuration above the frameGraph.build()/record() call and assert the inputs are set first."],"exampleFix":"// before\ntask.light = frameGraph.createLightInputValue(dirLight);\ntask.record(); // throws: objectList and camera missing\n\n// after\ntask.light = frameGraph.createLightInputValue(dirLight);\ntask.objectList = frameGraph.createObjectList([mesh1, mesh2]);\ntask.camera = frameGraph.createCameraInputValue(camera);\ntask.record();","handlingStrategy":"validation","validationCode":"function csmInputsReady(t: FrameGraphCascadedShadowGeneratorTask): boolean {\n    return t.light !== undefined && t.objectList !== undefined && t.camera !== undefined;\n}\nif (!csmInputsReady(task)) throw new Error(\"CSM task inputs incomplete\");\ntask.record();","typeGuard":"function isBound<T>(v: T | undefined): v is T {\n    return v !== undefined;\n}","tryCatchPattern":"try {\n    task.record();\n} catch (e) {\n    if ((e as Error).message.includes(\"light, objectList and camera are required\")) {\n        console.error(\"CSM task missing inputs:\", {\n            light: task.light,\n            objectList: task.objectList,\n            camera: task.camera,\n        });\n    } else throw e;\n}","preventionTips":["Assign light, objectList, and camera together in one setup function.","Create the object list via frameGraph.createObjectList before record().","Don't call frameGraph.build() until every task input is assigned.","Log the three inputs in dev builds before recording to catch regressions."],"tags":["babylonjs","frame-graph","csm","missing-input","validation"],"backgroundTag":"missing-required-parameter","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}