stride3d/stride · error · Exception
kind is inexistent
Error message
kind is inexistent
What it means
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.
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
Example fix
// before
else if (Pairs.Contains(logOp.Kind ?? throw new Exception("kind is inexistent")))
wid += 2;
// after
if (logOp.Kind is not { } kind)
throw new InvalidOperationException($"Operand {oid} of opcode {opcode} has no Kind in the grammar");
else if (Pairs.Contains(kind))
wid += 2; Defensive patterns
Strategy: validation
Validate before calling
if (logOp.Kind is null)
throw new InvalidOperationException($"Grammar descriptor for operand {oid} has no Kind"); Type guard
bool HasKind(OperandInfo op) => op.Kind.HasValue;
Prevention
- 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
When it happens
Trigger: 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 ...)).
Common situations: 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.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- Couldn't handle operand kind
- Couldn't handle operand
- Invalid SPIR-V instruction
- params of strings is not yet implemented
- params of strings is not yet implemented
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/fd80fb2b6aaa0db6.
Report an issue: GitHub.
Appendix: source
Thrown at sources/shaders/Stride.Shaders.Spirv/Parsing/OperandEnumerator.cs:42
if (logicalOperands[0].Kind == OperandKind.None)
return false;
return true;
}
else if (oid >= logicalOperands.Count - 1)
return false;
else
{
var logOp = logicalOperands[oid];
if (logOp.Quantifier == OperandQuantifier.One)
{
if (logOp.Kind == OperandKind.LiteralString)
{
while (!Operands[wid].HasEndString())
wid += 1;
wid += 1;
}
else if (Pairs.Contains(logOp.Kind ?? throw new Exception("kind is inexistent")))
wid += 2;
else
wid += 1;
oid += 1;
}
else if (logOp.Quantifier == OperandQuantifier.ZeroOrOne)
{
if (
Pairs.Contains(logOp.Kind ?? throw new Exception("kind is inexistent"))
&& wid < Operands.Length - 1
)
{
wid += 2;
}
else if (
logOp.Kind == OperandKind.LiteralString
&& wid < Operands.LengthView on GitHub (pinned to 96fad776d2)