oracle/graal · error · IllegalArgumentException

Bad primitive kind:

Error message

Bad primitive kind: 

What it means

Error "Bad primitive kind: " thrown in oracle/graal.

Source

Thrown at espresso-compiler-stub/src/com.oracle.truffle.espresso.vmaccess/src/com/oracle/truffle/espresso/vmaccess/EspressoExternalVMAccess.java:862

    }

    @SuppressWarnings("unchecked")
    static <T extends Throwable> RuntimeException sneakyThrow(Throwable ex) throws T {
        throw (T) ex;
    }

    Value getPrimitiveClass(JavaKind kind) {
        return switch (kind) {
            case Boolean -> getPrimitiveClass("Boolean");
            case Byte -> getPrimitiveClass("Byte");
            case Short -> getPrimitiveClass("Short");
            case Char -> getPrimitiveClass("Character");
            case Int -> getPrimitiveClass("Integer");
            case Float -> getPrimitiveClass("Float");
            case Long -> getPrimitiveClass("Long");
            case Double -> getPrimitiveClass("Double");
            case Void -> getPrimitiveClass("Void");
            default -> throw new IllegalArgumentException("Bad primitive kind: " + kind);
        };
    }

    private Value getPrimitiveClass(String boxName) {
        String identifier = "java.lang." + boxName;
        Value result = requireMetaObject(context, identifier).getMember("TYPE");
        assert result.getMember("static").isMetaObject() : result;
        return result;
    }

    private static Value requireMetaObject(Context context, String name) {
        Value result = lookupMetaObject(context, name);
        JVMCIError.guarantee(result != null && !result.isNull(), "Couldn't find %s", name);
        return result;
    }

    private static Value lookupMetaObject(Context context, String name) {
        Value result = context.getBindings("java").getMember(name);

View on GitHub (pinned to a66e9ccd1d)

Solutions

  1. Fix the condition reported by the error: Bad primitive kind:
  2. Check the throwing call site and ensure its documented preconditions (argument values, types, environment, or configuration) are satisfied before the call.

Example fix

Validate inputs and environment so that the failing condition does not occur: Bad primitive kind:

When it happens

Trigger: Thrown at espresso-compiler-stub/src/com.oracle.truffle.espresso.vmaccess/src/com/oracle/truffle/espresso/vmaccess/EspressoExternalVMAccess.java:862 when the library encounters an invalid state.

Common situations: Occurs when a caller violates the contract guarded by this check: Bad primitive kind:


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