oracle/graal · error · IllegalStateException

invalid primitive component type {}

Error message

invalid primitive component type {}

What it means

JDWPContextImpl parses a class-file type signature into KlassRefs; when the name denotes a primitive (single letter per JVMS: V Z S C B J D F) but the letter is none of them, it throws IllegalStateException('invalid primitive component type'). This is a debugger-backend invariant: only valid JVM primitive descriptors may reach this branch.

Source

Thrown at espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime/JDWPContextImpl.java:200

            switch (slashName) {
                case "I":
                    return new KlassRef[]{context.getMeta()._int};
                case "Z":
                    return new KlassRef[]{context.getMeta()._boolean};
                case "S":
                    return new KlassRef[]{context.getMeta()._short};
                case "C":
                    return new KlassRef[]{context.getMeta()._char};
                case "B":
                    return new KlassRef[]{context.getMeta()._byte};
                case "J":
                    return new KlassRef[]{context.getMeta()._long};
                case "D":
                    return new KlassRef[]{context.getMeta()._double};
                case "F":
                    return new KlassRef[]{context.getMeta()._float};
                default:
                    throw new IllegalStateException("invalid primitive component type " + slashName);
            }
        } else if (slashName.startsWith("[")) {
            // array type
            int dimensions = 0;
            for (char c : slashName.toCharArray()) {
                if ('[' == c) {
                    dimensions++;
                } else {
                    break;
                }
            }
            String componentRawName = slashName.substring(dimensions);
            if (componentRawName.length() == 1) {
                // primitive
                switch (componentRawName) {
                    case "I":
                        return new KlassRef[]{context.getMeta()._int.getArrayClassNoCreate(dimensions)};
                    case "Z":

View on GitHub (pinned to a66e9ccd1d)

Solutions

  1. Fix the JDWP client to send valid JVMS primitive descriptors (V, Z, S, C, B, J, D, F) or proper L...;/[... descriptors.
  2. Validate/normalize signature strings before sending them to the debugger backend.
  3. If the signature comes from the IDE, verify the IDE and GraalVM versions are compatible; report a GraalVM bug if a well-formed signature triggers it.
Defensive patterns

Strategy: validation

Validate before calling

private static final Set<String> VALID_PRIM = Set.of("V","Z","S","C","B","J","D","F");
boolean ok = name.length() == 1 && VALID_PRIM.contains(name);

Try / catch

try {
    refs = parseSignature(sig);
} catch (IllegalStateException e) {
    if (e.getMessage().startsWith("invalid primitive component type")) { /* bad signature from client */ }
}

Prevention

When it happens

Trigger: A JDWP client (debugger) sends a signature string whose first character implies a primitive (or the fallback default case is reached) with an invalid letter, e.g. 'A', 'P', or a typo'd descriptor; usually via ReferenceType queries with hand-built signature strings.

Common situations: Custom JDWP clients or IDE plugins sending malformed type signatures; tools upgrading across JVM versions where new descriptor forms appear; rarely, an Espresso bug producing a bad signature.

Related errors


AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14). Data as JSON: /api/errors/122b4110a83904bb. Report an issue: GitHub.