oracle/graal · error · ParserException.ClassFormatError
Array with more than 255 dimensions {}
Error message
Array with more than 255 dimensions {} What it means
For array descriptors, skipValidTypeDescriptor counts leading '[' characters; the JVM spec limits arrays to 255 dimensions. More than 255 consecutive '[' throws ParserException.ClassFormatError 'Array with more than 255 dimensions <rest-of-descriptor>' before recursing into the element type.
Source
Thrown at espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/TypeSymbols.java:239
return beginIndex + 1;
}
switch (ch) {
case 'L': {
final int endIndex = skipClassName(descriptor, beginIndex + 1, slashes ? '/' : '.');
if (endIndex > beginIndex + 1 && endIndex < descriptor.length() && descriptor.byteAt(endIndex) == ';') {
return endIndex + 1;
}
throw new ParserException.ClassFormatError("Invalid Java name " + descriptor.subSequence(beginIndex));
}
case '[': {
// compute the number of dimensions
int index = beginIndex;
while (index < descriptor.length() && descriptor.byteAt(index) == '[') {
index++;
}
final int dimensions = index - beginIndex;
if (dimensions > 255) {
throw new ParserException.ClassFormatError("Array with more than 255 dimensions " + descriptor.subSequence(beginIndex));
}
return skipValidTypeDescriptor(descriptor, index, slashes);
}
}
throw new ParserException.ClassFormatError("Invalid type descriptor " + descriptor.subSequence(beginIndex));
}
/**
* Gets the type descriptor for the specified component type descriptor with the specified
* number of dimensions. For example if the number of dimensions is 1, then this method will
* return a descriptor for an array of the component type; if the number of dimensions is 2, it
* will return a descriptor for an array of an array of the component type, etc.
*
* @param type the type descriptor for the component type of the array
* @param dimensions the number of array dimensions
* @return the canonical type descriptor for the specified component type and dimensions
*/
public Symbol<Type> arrayOf(Symbol<Type> type, int dimensions) {View on GitHub (pinned to a66e9ccd1d)
Solutions
- Cap array nesting in your generator at 255 dimensions and assert on it
- Fix the recursive loop that keeps adding dimensions (usually a missing termination condition)
- Validate incoming descriptors with a dimension count check before parsing
Example fix
// before
while (someCondition) { desc = "[" + desc; } // unbounded
// after
int dims = 0;
while (someCondition && dims < 255) { desc = "[" + desc; dims++; } Defensive patterns
Strategy: validation
Validate before calling
int dims = 0; while (dims < desc.length() && desc.charAt(dims) == '[') dims++;
if (dims > 255) throw new IllegalArgumentException("Array dimensions " + dims + " exceed 255: " + desc); Type guard
static boolean dimensionCountOk(String d) { int n = 0; while (n < d.length() && d.charAt(n) == '[') n++; return n <= 255; } Try / catch
catch (ParserException.ClassFormatError e) { report dimension count and cap recursion in the generator } Prevention
- Bound any dimension-adding loop at 255
- Suspect runaway recursion whenever deeply nested '[' appear in generated descriptors
When it happens
Trigger: Descriptors with 256+ leading '[' — usually produced by a loop that prepends '[' per array nesting level (e.g. recursive type mapping) or by a generator bug adding dimensions each iteration.
Common situations: Recursive generic array conversion where each recursion adds a dimension; fuzzed/malformed class files; copy loops that never terminate but append '[' each pass.
Related errors
- unknown primitive or void type character:
- invalid descriptor: {}
- invalid type descriptor: {}
- Invalid Java name {}
- Invalid type descriptor {}
AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14).
Data as JSON: /api/errors/1c7d6cc1bf480b31.
Report an issue: GitHub.