{"record":{"id":"ef75b8300c9944e3","repo":"stride3d/stride","slug":"no-voxel-volume-component-selected-for-voxel-light","errorCode":null,"errorMessage":"No Voxel Volume Component selected for voxel light.","messagePattern":"No Voxel Volume Component selected for voxel light\\.","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Voxels/Voxels/Light/LightVoxelRenderer.cs","lineNumber":106,"sourceCode":"            private PermutationParameterKey<ShaderSource> specularMarcherKey;\n            private PermutationParameterKey<ShaderSourceCollection> attributeSamplersKey;\n\n            public RenderLight Light { get; set; }\n\n            VoxelAttribute traceAttribute = null;\n\n            public LightVoxelShaderGroup(ShaderSource mixin) : base(mixin)\n            {\n                HasEffectPermutations = true;\n                traceAttribute = null;\n            }\n\n            ProcessedVoxelVolume GetProcessedVolume()\n            {\n                var lightVoxel = ((LightVoxel)Light.Type);\n                if (lightVoxel.Volume == null)\n                {\n                    throw new ArgumentNullException(\"No Voxel Volume Component selected for voxel light.\");\n                }\n                var voxelVolumeProcessor = lightVoxel.Volume.Entity.EntityManager.GetProcessor<VoxelVolumeProcessor>();\n                if (voxelVolumeProcessor == null)\n                    return null;\n\n                ProcessedVoxelVolume processedVolume = voxelVolumeProcessor.GetProcessedVolumeForComponent(lightVoxel.Volume);\n                return processedVolume;\n            }\n\n            VoxelAttribute GetTraceAttr()\n            {\n                var lightVoxel = ((LightVoxel)Light.Type);\n\n                ProcessedVoxelVolume processedVolume = GetProcessedVolume();\n                if (processedVolume == null)\n                    return null;\n\n                if (processedVolume.OutputAttributes.Count > lightVoxel.AttributeIndex)","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Voxels/Voxels/Light/LightVoxelRenderer.cs#L88-L124","documentation":"LightVoxelRenderer's GetProcessedVolume throws ArgumentNullException when a voxel light's LightVoxel type has Volume == null, i.e. no Voxel Volume component was assigned to the light. A voxel light can only be traced through a voxel volume, so without one the renderer cannot proceed. Notably it uses ArgumentNullException for what is semantically a missing component reference.","triggerScenarios":"Adding/using a LightVoxel light whose Volume property was never assigned (or was cleared), then rendering a frame where processedVolume is queried.","commonSituations":"Creating a voxel light in code without setting light.Type.Volume; a scene edit/prefab update clearing the volume reference; deleting a voxel volume entity that lights still pointed to.","solutions":["Assign a Voxel Volume component to the light's Volume property in the editor or code.","Before rendering, check lightVoxel.Volume for null and skip or disable the light.","Fix broken scene references so lights point at existing voxel volume entities."],"exampleFix":"// before\nvar light = new LightComponent { Type = new LightVoxel() }; // Volume not set\n// after\nvar light = new LightComponent { Type = new LightVoxel { Volume = myVoxelVolumeComponent } };","handlingStrategy":"type-guard","validationCode":"if (light.Type is LightVoxel lv && lv.Volume == null)\n{\n    // skip or disable this light\n    return null;\n}","typeGuard":"bool HasVoxelVolume(LightComponent light) => light.Type is LightVoxel lv && lv.Volume != null;","tryCatchPattern":"try { var vol = GetProcessedVolume(); }\ncatch (ArgumentNullException) { /* no volume assigned; disable light */ }","preventionTips":["Always assign a Voxel Volume component to voxel lights.","Check for broken/null component references after scene or prefab edits.","Guard lights before rendering when building scenes in code."],"tags":["stride","voxels","light","null-reference","missing-component"],"backgroundTag":"null-argument","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}