{"record":{"id":"6a9203ab583f6ef4","repo":"stride3d/stride","slug":"operand-kind-not-recognized","errorCode":null,"errorMessage":"Operand kind not recognized","messagePattern":"Operand kind not recognized","errorType":"exception","errorClass":"NotImplementedException","httpStatus":null,"severity":"error","filePath":"sources/shaders/Stride.Shaders.Spirv/Information/LogicalOperand.Size.cs","lineNumber":72,"sourceCode":"            or OperandKind.KernelEnqueueFlags\n            or OperandKind.Capability\n            or OperandKind.RayQueryIntersection\n            or OperandKind.RayQueryCommittedIntersectionType\n            or OperandKind.RayQueryCandidateIntersectionType\n            or OperandKind.IdResultType\n            or OperandKind.IdResult\n            or OperandKind.IdMemorySemantics\n            or OperandKind.IdScope\n            or OperandKind.IdRef\n            or OperandKind.LiteralInteger => 1,\n            OperandKind.LiteralString => -1,\n            OperandKind.LiteralContextDependentNumber => -1,\n            OperandKind.LiteralExtInstInteger => 1,\n            OperandKind.LiteralSpecConstantOpInteger => 1,\n            OperandKind.PairLiteralIntegerIdRef => 2,\n            OperandKind.PairIdRefLiteralInteger => 2,\n            OperandKind.PairIdRefIdRef => 2,\n            _ => throw new NotImplementedException(\"Operand kind not recognized\")\n        };\n    }\n}\n","sourceCodeStart":54,"sourceCodeEnd":76,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/shaders/Stride.Shaders.Spirv/Information/LogicalOperand.Size.cs#L54-L76","documentation":"LogicalOperand.GetWordSize maps each SPIR-V operand kind to its word count. The switch covers all known kinds but its default arm throws NotImplementedException for an OperandKind value it does not recognize, which can only happen with an unknown/extended kind produced by a newer SPIR-V specification or a corrupt instruction stream.","triggerScenarios":"Decoding a SPIR-V module whose instruction operand kinds include a value outside the enumerated LogicalOperand kinds — e.g. a module generated by a newer SPIR-V spec version than this library supports, or a corrupted bytecode where the instruction layout is misread and a wrong kind is derived.","commonSituations":"Parsing SPIR-V emitted by a newer glslang/spirv-tools than the parser supports; a misaligned/corrupted bytecode stream causing operand misinterpretation; extension-specific operands the library has not mapped.","solutions":["Upgrade Stride.Shaders.Spirv to a version that recognizes the newer SPIR-V spec operand kinds","Regenerate/re-export the SPIR-V module with an older toolchain whose operand kinds match the supported grammar","Validate the bytecode with spirv-val to rule out corruption, then re-serialize it canonically"],"exampleFix":"// before\nvar bytecode = CompileWithNewestGlslang(source); // emits operand kinds this parser lacks\n// after\nvar bytecode = CompileWithGlslangVersion(source, \"11.1.2\"); // matches supported SPIR-V 1.5 grammar","handlingStrategy":"try-catch","validationCode":"// Prefer validating the module with spirv-val before decoding with this library\n// and pin the SPIR-V version your pipeline emits:\nif (header.Version > SupportedMaxVersion)\n    throw new NotSupportedException($\"SPIR-V {header.Version} exceeds parser-supported grammar.\");","typeGuard":null,"tryCatchPattern":"try\n{\n    var size = LogicalOperand.GetWordSize(kind);\n}\ncatch (NotImplementedException)\n{\n    log.Error(\"Unknown SPIR-V operand kind; module was produced by a newer spec or is corrupt.\");\n}","preventionTips":["Keep the SPIR-V emitting toolchain version compatible with the parser library version","Run spirv-val on modules before feeding them to custom decoders","Re-serialize modules with spirv-opt to normalize operand layouts"],"tags":["spirv","decoder","unsupported-operand","version-mismatch"],"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-23T08:17:48.524Z"}