{"record":{"id":"ed217904d03ad603","repo":"antlr/antlr4","slug":"the-specified-transition-type-is-not-valid-ed2179","errorCode":null,"errorMessage":"The specified transition type is not valid.","messagePattern":"The specified transition type is not valid\\.","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"critical","filePath":"runtime/CSharp/src/Atn/ATNDeserializer.cs","lineNumber":1031,"sourceCode":"                    return a;\n                }\n\n                case TransitionType.SET:\n                {\n                    return new SetTransition(target, sets[arg1]);\n                }\n\n                case TransitionType.NOT_SET:\n                {\n                    return new NotSetTransition(target, sets[arg1]);\n                }\n\n                case TransitionType.WILDCARD:\n                {\n                    return new WildcardTransition(target);\n                }\n            }\n            throw new ArgumentException(\"The specified transition type is not valid.\");\n        }\n\n        protected internal virtual ATNState StateFactory(StateType type, int ruleIndex)\n        {\n            ATNState s;\n            switch (type)\n            {\n                case StateType.InvalidType:\n                {\n                    return null;\n                }\n\n                case StateType.Basic:\n                {\n                    s = new BasicState();\n                    break;\n                }\n","sourceCodeStart":1013,"sourceCodeEnd":1049,"githubUrl":"https://github.com/antlr/antlr4/blob/7d5770395bb7b02eb56e7c62662cb1d7c08f42a3/runtime/CSharp/src/Atn/ATNDeserializer.cs#L1013-L1049","documentation":"ATNDeserializer.EdgeFactory switches on the serialized transition type to build the right Transition subclass; the fall-through after the switch throws ArgumentException('The specified transition type is not valid.') for an unrecognized transition type byte. Valid types are EPSILON, RULE, PREDICATE, ATOM, RANGE, ACTION, SET, NOT_SET, WILDCARD, PRECEDENCE — a value outside this set means the data is corrupt or from an incompatible serialization.","triggerScenarios":"Deserializing an ATN whose transition type field is out of range — truncated/mismatched serialized ATN data, or ATN bytes generated by a different ANTLR serialization version.","commonSituations":"Tool/runtime version mismatch (most common), hand-crafted or copied serialized ATN strings that got corrupted, or a partially regenerated grammar where lexer and parser ATNs come from different versions.","solutions":["Regenerate all parsers/lexers with the tool version matching the runtime and rebuild","Ensure the serialized ATN data reaches the deserializer intact (no truncation, correct encoding)","Align every project in the solution on one Antlr4.Runtime version"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { new ATNDeserializer().Deserialize(data); } catch (ArgumentException e) { /* transition type out of range: serialized ATN corrupt or version-mismatched; regenerate */ }","preventionTips":["Regenerate all grammars when either tool or runtime version changes","Ensure serialized ATN strings are not edited or re-encoded by build steps"],"tags":["antlr","atn","version-mismatch","csharp"],"backgroundTag":null,"analyzedSha":"7d5770395bb7b02eb56e7c62662cb1d7c08f42a3","analyzedAt":"2026-08-14T14:47:56.354Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}