{"record":{"id":"fd80fb2b6aaa0db6","repo":"stride3d/stride","slug":"kind-is-inexistent","errorCode":null,"errorMessage":"kind is inexistent","messagePattern":"kind is inexistent","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"sources/shaders/Stride.Shaders.Spirv/Parsing/OperandEnumerator.cs","lineNumber":42,"sourceCode":"            if (logicalOperands[0].Kind == OperandKind.None)\n                return false;\n            return true;\n        }\n        else if (oid >= logicalOperands.Count - 1)\n            return false;\n        else\n        {\n            var logOp = logicalOperands[oid];\n\n            if (logOp.Quantifier == OperandQuantifier.One)\n            {\n                if (logOp.Kind == OperandKind.LiteralString)\n                {\n                    while (!Operands[wid].HasEndString())\n                        wid += 1;\n                    wid += 1;\n                }\n                else if (Pairs.Contains(logOp.Kind ?? throw new Exception(\"kind is inexistent\")))\n                    wid += 2;\n                else\n                    wid += 1;\n                oid += 1;\n\n            }\n            else if (logOp.Quantifier == OperandQuantifier.ZeroOrOne)\n            {\n                if (\n                    Pairs.Contains(logOp.Kind ?? throw new Exception(\"kind is inexistent\"))\n                    && wid < Operands.Length - 1\n                )\n                {\n                    wid += 2;\n                }\n                else if (\n                    logOp.Kind == OperandKind.LiteralString\n                    && wid < Operands.Length","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/shaders/Stride.Shaders.Spirv/Parsing/OperandEnumerator.cs#L24-L60","documentation":"OperandEnumerator.MoveNext walks the SPIR-V instruction operand words against the grammar's logical operand descriptions. When a logical operand descriptor has no Kind (null), the enumerator cannot know how many words it consumes, so it throws this Exception. This indicates a malformed or incomplete operand descriptor for the opcode being parsed.","triggerScenarios":"Iterating operands of a SPIR-V instruction whose grammar entry contains a logical operand with Kind == null and Quantifier that is not One (the null Kind check is hit in the ZeroOrOne/ZeroOrMore/logical-else branches via Pairs.Contains(logOp.Kind ?? throw ...)).","commonSituations":"Parsing SPIR-V modules produced by newer or non-standard toolchains whose opcodes are not in the generated grammar tables; a codegen bug in the grammar-to-C# generation leaving Kind unset; manually constructed OperandInfo with missing Kind.","solutions":["Regenerate/repair the SPIR-V grammar tables (Grammar/JsonGrammar generation) so every logical operand has a Kind","Check the opcode of the failing instruction against the SPIRV-LS grammar for missing operand definitions","Wrap instruction parsing in try/catch and log the opcode to identify the grammar gap","Update the Stride SPIR-V specification bindings to the version matching the module being parsed"],"exampleFix":"// before\nelse if (Pairs.Contains(logOp.Kind ?? throw new Exception(\"kind is inexistent\")))\n    wid += 2;\n// after\nif (logOp.Kind is not { } kind)\n    throw new InvalidOperationException($\"Operand {oid} of opcode {opcode} has no Kind in the grammar\");\nelse if (Pairs.Contains(kind))\n    wid += 2;","handlingStrategy":"validation","validationCode":"if (logOp.Kind is null)\n    throw new InvalidOperationException($\"Grammar descriptor for operand {oid} has no Kind\");","typeGuard":"bool HasKind(OperandInfo op) => op.Kind.HasValue;","tryCatchPattern":null,"preventionTips":["Keep SPIR-V grammar bindings regenerated from the official grammar JSON in sync","Validate grammar tables at startup/test time (assert no operand lacks Kind)","Log opcode + operand index when parsing fails","Pin the module generator version to one supported by the grammar tables"],"tags":["spirv","parsing","grammar"],"backgroundTag":"internal-invariant-violation","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"}