{"record":{"id":"b29ecba5ee16c19c","repo":"stride3d/stride","slug":"unable-to-find-generate-key-0-with-unsupported-type-1-2","errorCode":null,"errorMessage":"Unable to find/generate key [{0}] with unsupported type [{1}/{2}]","messagePattern":"Unable to find/generate key \\[(.+?)\\] with unsupported type \\[(.+?)/(.+?)\\]","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Graphics/Effects/Effect.cs","lineNumber":266,"sourceCode":"                        case EffectParameterType.Texture2D:\n                        case EffectParameterType.Texture2DArray:\n                        case EffectParameterType.Texture2DMultisampled:\n                        case EffectParameterType.Texture2DMultisampledArray:\n                        case EffectParameterType.RWTexture2D:\n                        case EffectParameterType.RWTexture2DArray:\n                        case EffectParameterType.TextureCube:\n                        case EffectParameterType.TextureCubeArray:\n                        case EffectParameterType.RWTexture3D:\n                        case EffectParameterType.Texture3D:\n                            keyInfo.Key = FindOrCreateResourceKey<Texture>(keyName);\n                            break;\n                    }\n                    break;\n            }\n\n            if (keyInfo.Key == null)\n            {\n                throw new InvalidOperationException(string.Format(\"Unable to find/generate key [{0}] with unsupported type [{1}/{2}]\", keyInfo.KeyName, @class, type));\n            }\n        }\n\n        private static void UpdateValueBindingKey(ref EffectValueDescription binding)\n        {\n            switch (binding.Type.Class)\n            {\n                case EffectParameterClass.Scalar:\n                    switch (binding.Type.Type)\n                    {\n                        case EffectParameterType.Bool:\n                            binding.KeyInfo.Key = FindOrCreateValueKey<bool>(ref binding);\n                            break;\n                        case EffectParameterType.Int:\n                            binding.KeyInfo.Key = FindOrCreateValueKey<int>(ref binding);\n                            break;\n                        case EffectParameterType.UInt:\n                            binding.KeyInfo.Key = FindOrCreateValueKey<uint>(ref binding);","sourceCodeStart":248,"sourceCodeEnd":284,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Graphics/Effects/Effect.cs#L248-L284","documentation":"Effect.ResolveResourceKey throws InvalidOperationException when it cannot generate a resource binding key for a shader parameter: the parameter's resource class and type combination is not handled by the key-generation switch, leaving keyInfo.Key null. Usually means the effect was compiled with a parameter type the runtime binding layer does not know.","triggerScenarios":"Loading/initializing an effect whose EffectValueDescription has a Class/Type pair outside the supported set (e.g. an unrecognized TextureType/class, new shader parameter kind, or a corrupted/mismatched effects database) while resolving keys during UpdateResourceBindingKey/UpdateResourceEntryKey.","commonSituations":"Custom shader plugins introducing new parameter types; effects compiled by a newer Stride version than the runtime; stale or mismatched compiled-effect assets after engine upgrade.","solutions":["Recompile all shaders and rebuild the effects database with the same Stride version as the runtime.","Check the failing parameter's shader declaration and change it to a supported type (Texture2D, Sampler, constant buffer member types).","Verify engine/runtime version consistency — rebuild custom effect code after a Stride upgrade.","Inspect keyInfo.KeyName in the message to locate the offending shader parameter and fix its declaration."],"exampleFix":"// before (custom/unrecognized type in shader)\nmy_custom_resource customRes;\n// after\nTexture2D myTexture : register(t0); // use a supported resource type","handlingStrategy":"try-catch","validationCode":"try\n{\n    effect.InitializeFrom(device, bytecode);\n}\ncatch (InvalidOperationException ex) when (ex.Message.StartsWith(\"Unable to find/generate key\"))\n{\n    log.Error($\"Unsupported shader parameter on effect {bytecode?.SourceFilename}: {ex.Message}\");\n}","typeGuard":"bool HasKnownParameterTypes(Effect effect) =>\n    effect.Description.EffectKeys.All(k => IsSupportedResourceClass(k.Class, k.Type));","tryCatchPattern":"try { var effect = new Effect(device, bytecode); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"unsupported type\"))\n{ log.Error(ex, \"Recompile shaders with the current Stride version\"); throw; }","preventionTips":["Recompile shaders and rebuild the effects database after every Stride upgrade.","Use only resource types the runtime binding layer supports in custom shaders.","Pin the same Stride version across shader compilation and runtime execution.","Log the parameter name from the message to quickly find the offending shader declaration."],"tags":["effect","shader-parameters","resource-binding","version-mismatch"],"backgroundTag":"unexpected-response-shape","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}