{"record":{"id":"cbdfb6237199964f","repo":"antlr/antlr4","slug":"rulename-cannot-be-null-or-empty","errorCode":null,"errorMessage":"ruleName cannot be null or empty.","messagePattern":"ruleName cannot be null or empty\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"runtime/Java/src/org/antlr/v4/runtime/tree/pattern/RuleTagToken.java","lineNumber":61,"sourceCode":"\tpublic RuleTagToken(String ruleName, int bypassTokenType) {\n\t\tthis(ruleName, bypassTokenType, null);\n\t}\n\n\t/**\n\t * Constructs a new instance of {@link RuleTagToken} with the specified rule\n\t * name, bypass token type, and label.\n\t *\n\t * @param ruleName The name of the parser rule this rule tag matches.\n\t * @param bypassTokenType The bypass token type assigned to the parser rule.\n\t * @param label The label associated with the rule tag, or {@code null} if\n\t * the rule tag is unlabeled.\n\t *\n\t * @exception IllegalArgumentException if {@code ruleName} is {@code null}\n\t * or empty.\n\t */\n\tpublic RuleTagToken(String ruleName, int bypassTokenType, String label) {\n\t\tif (ruleName == null || ruleName.isEmpty()) {\n\t\t\tthrow new IllegalArgumentException(\"ruleName cannot be null or empty.\");\n\t\t}\n\n\t\tthis.ruleName = ruleName;\n\t\tthis.bypassTokenType = bypassTokenType;\n\t\tthis.label = label;\n\t}\n\n\t/**\n\t * Gets the name of the rule associated with this rule tag.\n\t *\n\t * @return The name of the parser rule associated with this rule tag.\n\t */\n\n\tpublic final String getRuleName() {\n\t\treturn ruleName;\n\t}\n\n\t/**","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/antlr/antlr4/blob/7d5770395bb7b02eb56e7c62662cb1d7c08f42a3/runtime/Java/src/org/antlr/v4/runtime/tree/pattern/RuleTagToken.java#L43-L79","documentation":"Error \"ruleName cannot be null or empty.\" thrown in antlr/antlr4.","triggerScenarios":"RuleTagToken constructed with a null or empty ruleName.","commonSituations":"Supply a valid parser rule name when creating RuleTagToken; empty tags like <> are rejected.","solutions":["Pass a non-null, non-empty rule name to the RuleTagToken constructor.","Let ParseTreePatternMatcher.compile build tag tokens for you rather than constructing RuleTagToken manually."],"exampleFix":"RuleTagToken t = new RuleTagToken(\"expr\", MyParser.RULE_expr);","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7d5770395bb7b02eb56e7c62662cb1d7c08f42a3","analyzedAt":"2026-08-14T14:47:56.354Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}