oracle/graal · error · RuleParseError
not enough inputs for ${descriptor.name}
Error message
not enough inputs for ${descriptor.name} What it means
Thrown by RuleParser.parseExpression when a node type in a @MatchRule declares N inputs but fewer than N were supplied AND some input slot remained null after both the expression and parseType passes. Node types come from knownTypes built from @MatchableNode metadata, so the required arity is fixed by the node class; the pattern must fill every declared input.
Source
Thrown at compiler/src/jdk.graal.compiler.processor/src/jdk/graal/compiler/core/match/processor/MatchProcessor.java:169
boolean done() {
return current == tokens.length;
}
private MatchDescriptor parseExpression() {
if (peek("(").equals("(")) {
next();
MatchDescriptor descriptor = parseType(true);
for (int n = 0; n < descriptor.nodeType.inputs.size(); n++) {
if (peek("(").equals("(")) {
descriptor.inputs[n] = parseExpression();
} else {
descriptor.inputs[n] = parseType(false);
}
}
for (int n = 0; n < descriptor.nodeType.inputs.size(); n++) {
if (descriptor.inputs[n] == null) {
throw new RuleParseError("not enough inputs for " + descriptor.name);
}
}
if (peek(")").equals(")")) {
next();
return descriptor;
}
throw new RuleParseError("Too many arguments to " + descriptor.nodeType.nodeClass);
}
throw new RuleParseError("Extra tokens following match pattern: " + peek(null));
}
private MatchDescriptor parseType(boolean forExpression) {
TypeDescriptor type = null;
String name = null;
if (Character.isUpperCase(peek("node type or name").charAt(0))) {
String token = next();
type = knownTypes.get(token);
if (type == null) {View on GitHub (pinned to a66e9ccd1d)
Solutions
- Open the node class named in the rule and count its declared inputs (fields/inputs in @MatchableNode metadata); supply one pattern element per input.
- Use a captured name (lowercase identifier) or a wildcard-style type for inputs you do not care about, but do not omit them.
- After changing a @MatchableNode's inputs, grep for @MatchRule strings referencing that node and update them all.
Example fix
// before (Add has 2 inputs)
@MatchRule("Add(x)")
// after
@MatchRule("Add(x, y)") Defensive patterns
Strategy: try-catch
Try / catch
No runtime handling; the annotation processor fails the build. Grep build logs for 'not enough inputs' and cross-reference the node class's input count.
Prevention
- Always fill every declared input of the node type in the pattern, using capture names for don't-care slots.
- After changing a @MatchableNode's inputs, update every @MatchRule referencing it (grep the simple name).
- Keep input lists of matchable nodes stable across refactors where possible.
When it happens
Trigger: Writing @MatchRule("Add(x)") when the Add node declares two inputs; omitting optional-but-listed inputs is not supported at the pattern level — every entry in nodeType.inputs must get a slot. The loop assigns descriptor.inputs[n] from either parseExpression or parseType, then null-checks all slots.
Common situations: Adding a new input to a @MatchableNode class and forgetting to update existing rules; writing rules from memory instead of the node's input list; porting a rule from an older Graal version where the node had fewer inputs.
Related errors
- Too many arguments to ${descriptor.nodeType.nodeClass}
- Unexpected tokens :${rule.substring(m.end(), m.regionEnd())}
- didn't consume all tokens
- Out of tokens
- Out of tokens looking for %s
AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14).
Data as JSON: /api/errors/beac0cda8b044176.
Report an issue: GitHub.