{"record":{"id":"ad1bdb7f1e8e3861","repo":"oracle/graal","slug":"unsupported-kind","errorCode":null,"errorMessage":"Unsupported kind: {}","messagePattern":"Unsupported kind: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"info","filePath":"compiler/src/jdk.graal.compiler.hostvmaccess/src/jdk/graal/compiler/hostvmaccess/HostVMAccess.java","lineNumber":543,"sourceCode":"        if (offset < 0 || (long) offset + bytesToRead > sourceArrayEnd) {\n            throw new IllegalArgumentException(\n                            \"Invalid input range: \" + offset + \"..\" + (offset + bytesToRead) + \" for array of length \" + Array.getLength(array) + \" with kind \" +\n                                            arrayType.getComponentType().getJavaKind());\n        }\n\n        Unsafe unsafe = Unsafe.getUnsafe();\n        long baseOffset = unsafe.arrayBaseOffset(array.getClass());\n        long absoluteOffset = baseOffset + offset;\n        return switch (kind) {\n            case Boolean -> JavaConstant.forBoolean(unsafe.getByte(array, absoluteOffset) != 0);\n            case Byte -> JavaConstant.forByte(unsafe.getByte(array, absoluteOffset));\n            case Short -> JavaConstant.forShort(unsafe.getShort(array, absoluteOffset));\n            case Char -> JavaConstant.forChar(unsafe.getChar(array, absoluteOffset));\n            case Int -> JavaConstant.forInt(unsafe.getInt(array, absoluteOffset));\n            case Long -> JavaConstant.forLong(unsafe.getLong(array, absoluteOffset));\n            case Float -> JavaConstant.forFloat(unsafe.getFloat(array, absoluteOffset));\n            case Double -> JavaConstant.forDouble(unsafe.getDouble(array, absoluteOffset));\n            default -> throw new IllegalArgumentException(\"Unsupported kind: \" + kind);\n        };\n    }\n\n    @Override\n    public JavaConstant createHostProxy(Object hostTarget, ResolvedJavaType guestType) {\n        Objects.requireNonNull(hostTarget);\n        Class<?> guestClass = providers.getSnippetReflection().originalClass(Objects.requireNonNull(guestType));\n        if (guestClass == null || !guestClass.isInterface()) {\n            throw new IllegalArgumentException(\"Invalid guest type\");\n        }\n        /* There is no fast-path for guestClass == hostClass due to exception handling */\n        HostProxyHandler handler = new HostProxyHandler(hostTarget, getHostProxyMethodMap(hostTarget.getClass(), guestClass));\n        Object guestHostProxy = Proxy.newProxyInstance(guestClass.getClassLoader(), new Class<?>[]{guestClass}, handler);\n        return providers.getSnippetReflection().forObject(guestHostProxy);\n    }\n\n    @Override\n    public Throwable unwrapHostProxyException(JavaConstant guestWrapper) {","sourceCodeStart":525,"sourceCodeEnd":561,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/jdk.graal.compiler.hostvmaccess/src/jdk/graal/compiler/hostvmaccess/HostVMAccess.java#L525-L561","documentation":"The final default arm of the JavaKind switch in readPrimitiveArrayUnaligned's Unsafe read. Because line 512 already rejected null/non-primitive/void kinds, every remaining primitive kind (Boolean..Double) has a case, so this 'Unsupported kind' IllegalArgumentException is defensively unreachable in normal use. Seeing it means the kind validation and the read switch have drifted apart (e.g. a new JavaKind value added to the enum, or validation was bypassed/changed).","triggerScenarios":"A future JavaKind constant that isPrimitive() returns true for but has no case in the switch; or a subclass/patched variant where the guard at line 512 is relaxed. Not reachable via the public API as currently written.","commonSituations":"After upgrading the JDK/jdk.vm.ci where JavaKind gains a value; local forks of Graal that modify the kind validation.","solutions":["If hit after a JDK/JVMCI upgrade, add the missing kind case to the switch (or extend the front guard to exclude it)","Check for local patches that weakened the kind check at the top of readPrimitiveArrayUnaligned","Report upstream — as shipped, this branch indicates an internal inconsistency, not caller error"],"exampleFix":"// before (JVMCI adds JavaKind.Float16, isPrimitive()==true)\n// switch lacks a case -> 'Unsupported kind: Float16'\n\n// after\ncase Float16 -> JavaConstant.forShort(unsafe.getShort(array, absoluteOffset)); // decode as needed","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"catch (IllegalArgumentException e) { if (\"Unsupported kind\".equals(prefix of message)) { log kind value and Graal/JVMCI versions; this signals version drift, report upstream; } }","preventionTips":["Pin jdk.vm.ci and Graal versions together when upgrading the JDK","Run the hostvmaccess unit tests after any JVMCI upgrade","Treat this message as an internal invariant failure, not a caller bug"],"tags":["graalvm","vmaccess","defensive","javakind","version-drift"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}