{"record":{"id":"be975a559924a081","repo":"oracle/graal","slug":"too-many-arguments-to-descriptor-nodetype-nodecl","errorCode":null,"errorMessage":"Too many arguments to ${descriptor.nodeType.nodeClass}","messagePattern":"Too many arguments to (.+?)","errorType":"validation","errorClass":"RuleParseError","httpStatus":null,"severity":"error","filePath":"compiler/src/jdk.graal.compiler.processor/src/jdk/graal/compiler/core/match/processor/MatchProcessor.java","lineNumber":176,"sourceCode":"                next();\n                MatchDescriptor descriptor = parseType(true);\n                for (int n = 0; n < descriptor.nodeType.inputs.size(); n++) {\n                    if (peek(\"(\").equals(\"(\")) {\n                        descriptor.inputs[n] = parseExpression();\n                    } else {\n                        descriptor.inputs[n] = parseType(false);\n                    }\n                }\n                for (int n = 0; n < descriptor.nodeType.inputs.size(); n++) {\n                    if (descriptor.inputs[n] == null) {\n                        throw new RuleParseError(\"not enough inputs for \" + descriptor.name);\n                    }\n                }\n                if (peek(\")\").equals(\")\")) {\n                    next();\n                    return descriptor;\n                }\n                throw new RuleParseError(\"Too many arguments to \" + descriptor.nodeType.nodeClass);\n            }\n            throw new RuleParseError(\"Extra tokens following match pattern: \" + peek(null));\n        }\n\n        private MatchDescriptor parseType(boolean forExpression) {\n            TypeDescriptor type = null;\n            String name = null;\n            if (Character.isUpperCase(peek(\"node type or name\").charAt(0))) {\n                String token = next();\n                type = knownTypes.get(token);\n                if (type == null) {\n                    throw new RuleParseError(\"Unknown node type: \" + token);\n                }\n                if (peek(\"=\").equals(\"=\")) {\n                    next();\n                    name = next();\n                }\n                originatingElements.addAll(type.originatingElements);","sourceCodeStart":158,"sourceCodeEnd":194,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/jdk.graal.compiler.processor/src/jdk/graal/compiler/core/match/processor/MatchProcessor.java#L158-L194","documentation":"Thrown by RuleParser.parseExpression when the pattern inside parentheses has already filled every declared input of the node type but another token remains before the expected ')'. The parser fills exactly nodeType.inputs.size() slots, then requires the next token to be ')'; anything else is 'too many arguments'.","triggerScenarios":"Writing @MatchRule(\"Add(x, y, z)\") for a two-input node, or adding an extra captured name, constant pattern, or stray token after the last input. The offending extra is whatever precedes the missing ')'.","commonSituations":"Node refactorings that removed an input while old rules still pass three arguments; misunderstanding that trailing options/labels are not part of the DSL; duplicating an input while hand-editing.","solutions":["Count the arguments in the rule against the node class's declared inputs and delete the extras.","If you intended the extra element as a condition, move it into the match method's Java body, not the pattern.","Regenerate/re-read the node's input list after any @MatchableNode change and reconcile all rules."],"exampleFix":"// before (Add has 2 inputs)\n@MatchRule(\"Add(x, y, z)\")\n\n// after\n@MatchRule(\"Add(x, y)\")","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"Compile-time only; no catch site. Treat 'Too many arguments to <NodeClass>' in build output as an arity mismatch to fix in the @MatchRule string.","preventionTips":["Count pattern arguments against the node class's declared inputs before saving.","Put conditions in the generated method body, not extra pattern tokens.","Reconcile all rules after any change to a node's input count."],"tags":["graalvm","match-rules","annotation-processing","arity","compile-time"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}