{"record":{"id":"2393861b0df6d19e","repo":"antlr/antlr4","slug":"the-specified-transition-type-is-not-valid","errorCode":null,"errorMessage":"The specified transition type is not valid.","messagePattern":"The specified transition type is not valid\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"critical","filePath":"runtime/Java/src/org/antlr/v4/runtime/atn/ATNDeserializer.java","lineNumber":531,"sourceCode":"\t\t\t\treturn pt;\n\t\t\tcase Transition.PRECEDENCE:\n\t\t\t\treturn new PrecedencePredicateTransition(target, arg1);\n\t\t\tcase Transition.ATOM :\n\t\t\t\tif (arg3 != 0) {\n\t\t\t\t\treturn new AtomTransition(target, Token.EOF);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\treturn new AtomTransition(target, arg1);\n\t\t\t\t}\n\t\t\tcase Transition.ACTION :\n\t\t\t\tActionTransition a = new ActionTransition(target, arg1, arg2, arg3 != 0);\n\t\t\t\treturn a;\n\t\t\tcase Transition.SET : return new SetTransition(target, sets.get(arg1));\n\t\t\tcase Transition.NOT_SET : return new NotSetTransition(target, sets.get(arg1));\n\t\t\tcase Transition.WILDCARD : return new WildcardTransition(target);\n\t\t}\n\n\t\tthrow new IllegalArgumentException(\"The specified transition type is not valid.\");\n\t}\n\n\tprotected ATNState stateFactory(int type, int ruleIndex) {\n\t\tATNState s;\n\t\tswitch (type) {\n\t\t\tcase ATNState.INVALID_TYPE: return null;\n\t\t\tcase ATNState.BASIC : s = new BasicState(); break;\n\t\t\tcase ATNState.RULE_START : s = new RuleStartState(); break;\n\t\t\tcase ATNState.BLOCK_START : s = new BasicBlockStartState(); break;\n\t\t\tcase ATNState.PLUS_BLOCK_START : s = new PlusBlockStartState(); break;\n\t\t\tcase ATNState.STAR_BLOCK_START : s = new StarBlockStartState(); break;\n\t\t\tcase ATNState.TOKEN_START : s = new TokensStartState(); break;\n\t\t\tcase ATNState.RULE_STOP : s = new RuleStopState(); break;\n\t\t\tcase ATNState.BLOCK_END : s = new BlockEndState(); break;\n\t\t\tcase ATNState.STAR_LOOP_BACK : s = new StarLoopbackState(); break;\n\t\t\tcase ATNState.STAR_LOOP_ENTRY : s = new StarLoopEntryState(); break;\n\t\t\tcase ATNState.PLUS_LOOP_BACK : s = new PlusLoopbackState(); break;\n\t\t\tcase ATNState.LOOP_END : s = new LoopEndState(); break;","sourceCodeStart":513,"sourceCodeEnd":549,"githubUrl":"https://github.com/antlr/antlr4/blob/7d5770395bb7b02eb56e7c62662cb1d7c08f42a3/runtime/Java/src/org/antlr/v4/runtime/atn/ATNDeserializer.java#L513-L549","documentation":"While reading serialized edges, ATNDeserializer.edgeFactory maps transition type codes 1..10 to the known Transition classes (EPSILON through PRECEDENCE). Any other value means the integer stream is not a valid ATN edge table for this format and is rejected with IllegalArgumentException.","triggerScenarios":"Deserializing corrupted/truncated serialized ATN data; manually changing the serialized integer sequence so edge records become misaligned; or supplying data produced by an incompatible serializer/runtime pair.","commonSituations":"Mixed ANTLR tool/runtime versions, hand-edited generated _serializedATN strings, custom ATN serialization experiments, and partial copies of serialized data.","solutions":["Use serialized data produced by the matching ATNSerializer/ANTLR tool version.","Regenerate lexer/parser sources and clean-build.","Eliminate conflicting ANTLR runtime versions on the classpath.","Do not modify, truncate, or re-encode the generated serialized ATN."],"exampleFix":"// before\nATN atn = new ATNDeserializer().deserialize(modifiedSerializedAtn.toCharArray());\n\n// after: regenerate serialized ATN with the same tool/runtime and pass it unchanged\nATN atn = new ATNDeserializer().deserialize(MyLexer._serializedATN.toCharArray());","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    return new ATNDeserializer(options).deserialize(serialized);\n} catch (IllegalArgumentException e) {\n    throw new IllegalArgumentException(\"Serialized ATN transition table is corrupt or incompatible\", e);\n}","preventionTips":["Pass generated serialized ATN data unchanged.","Keep serializer and deserializer versions identical.","Treat any manual edit of serialized integers as unsupported."],"tags":["antlr","java","atn","transition","serialization","corruption"],"backgroundTag":null,"analyzedSha":"7d5770395bb7b02eb56e7c62662cb1d7c08f42a3","analyzedAt":"2026-08-14T14:47:56.354Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}