{"record":{"id":"1b21c6579f2289c7","repo":"stride3d/stride","slug":"streamtype-0-is-not-supported","errorCode":null,"errorMessage":"StreamType [{0}] is not supported","messagePattern":"StreamType \\[(.+?)\\] is not supported","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Rendering/Rendering/Materials/MaterialBlendLayerContext.cs","lineNumber":131,"sourceCode":"            }\n\n            string channel;\n            switch (streamType)\n            {\n                case MaterialStreamType.Float:\n                    channel = \"r\";\n                    break;\n                case MaterialStreamType.Float2:\n                    channel = \"rg\";\n                    break;\n                case MaterialStreamType.Float3:\n                    channel = \"rgb\";\n                    break;\n                case MaterialStreamType.Float4:\n                    channel = \"rgba\";\n                    break;\n                default:\n                    throw new NotSupportedException(\"StreamType [{0}] is not supported\".ToFormat(streamType));\n            }\n\n            var mixin = new ShaderMixinSource();\n            mixin.Mixins.Add(new ShaderClassSource(\"MaterialSurfaceSetStreamFromComputeColor\", stream, channel));\n            mixin.AddComposition(\"computeColorSource\", classSource);\n\n            GetContextPerStage(stage).ShaderSources.Add(mixin);\n        }\n\n        public ShaderSource GenerateStreamInitializers(MaterialShaderStage stage)\n        {\n            // Early exit if nothing to do\n            var stageContext = GetContextPerStage(stage);\n            if (stageContext.StreamInitializers.Count == 0 && stageContext.ShaderSources.Count == 0 && stage != MaterialShaderStage.Pixel)\n            {\n                return null;\n            }\n","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Rendering/Rendering/Materials/MaterialBlendLayerContext.cs#L113-L149","documentation":"The same SetStream flow converts a MaterialStreamType into the swizzle (channel mask) used by MaterialSurfaceSetStreamFromComputeColor. If the stream type is not Float, Float2, Float3, or Float4, it throws NotSupportedException naming the unsupported stream type.","triggerScenarios":"Calling SetStream with a MaterialStreamType outside the supported set (e.g. Half, Double, Int types, or a matrix type), so the channel switch falls through to default.","commonSituations":"Manually specifying a MaterialStreamType for a custom stream with a type the material system cannot map to a swizzle; passing a wrong enum value from custom blend layer code.","solutions":["Use MaterialStreamType.Float, Float2, Float3, or Float4 for the stream","Change the stream's declared type in the shader to a supported float-vector type","Add a case for the extra stream type in MaterialBlendLayerContext if you own the code","Print streamType in your code to confirm which value is being passed"],"exampleFix":"// before: unsupported integer stream type\ncontext.SetStream(stage, \"IndexStream\", MaterialStreamType.Int, classSource);\n// after: use a float stream\ncontext.SetStream(stage, \"IndexStream\", MaterialStreamType.Float, classSource);","handlingStrategy":"validation","validationCode":"if (streamType is not (MaterialStreamType.Float or MaterialStreamType.Float2 or MaterialStreamType.Float3 or MaterialStreamType.Float4))\n    throw new InvalidOperationException($\"StreamType {streamType} not supported\");","typeGuard":"bool IsSupportedStreamType(MaterialStreamType t) =>\n    t is MaterialStreamType.Float or MaterialStreamType.Float2 or MaterialStreamType.Float3 or MaterialStreamType.Float4;","tryCatchPattern":null,"preventionTips":["Declare custom shader streams as float/float2/float3/float4 only","Avoid half/int/matrix stream types in the material blend-layer API","Add a switch case upstream if a new stream type is truly needed"],"tags":["material","streams","unsupported-type","shader"],"backgroundTag":"unsupported-enum-value","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}