{"record":{"id":"93cc6d360baa351b","repo":"oracle/graal","slug":"expected-a-non-void-primitive-kind-got-93cc6d","errorCode":null,"errorMessage":"Expected a non-void primitive kind, got ","messagePattern":"Expected a non-void primitive kind, got ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"espresso-compiler-stub/src/com.oracle.truffle.espresso.vmaccess/src/com/oracle/truffle/espresso/vmaccess/EspressoExternalVMAccess.java","lineNumber":1043,"sourceCode":"        EspressoResolvedObjectType arrayType = objectConstant.getType();\n        if (!(arrayType.isArray() && arrayType.getComponentType().isPrimitive())) {\n            throw new IllegalArgumentException(\"Source should be a primitive array, got \" + arrayType);\n        }\n        try {\n            objectConstant.getValue().readBuffer(srcFrom, dst, dstFrom, srcTo - srcFrom);\n        } catch (IndexOutOfBoundsException e) {\n            throw new IllegalArgumentException(\"Failed to copy into \" + src, e);\n        }\n    }\n\n    /**\n     * The value is decoded directly from Espresso interop buffer access using native endianness to\n     * match hosted unaligned read semantics.\n     */\n    @Override\n    public JavaConstant readPrimitiveArrayUnaligned(JavaConstant array, JavaKind kind, int offset) {\n        if (kind == null || !kind.isPrimitive() || kind == JavaKind.Void) {\n            throw new IllegalArgumentException(\"Expected a non-void primitive kind, got \" + kind);\n        }\n        if (!(array instanceof EspressoExternalObjectConstant objectConstant)) {\n            throw new IllegalArgumentException(\"Expected an EspressoExternalObjectConstant, got \" + safeGetClass(array));\n        }\n        EspressoResolvedObjectType arrayType = objectConstant.getType();\n        if (!(arrayType.isArray() && arrayType.getComponentType().isPrimitive())) {\n            throw new IllegalArgumentException(\"Source should be a primitive array, got \" + arrayType);\n        }\n        Value value = objectConstant.getValue();\n        long byteLength = value.getBufferSize();\n        int bytesToRead = kind.getByteCount();\n        if (offset < 0 || (long) offset + bytesToRead > byteLength) {\n            throw new IllegalArgumentException(\"Invalid input range: \" + offset + \"..\" + (offset + bytesToRead) + \" for buffer size \" + byteLength);\n        }\n        return switch (kind) {\n            case Boolean -> JavaConstant.forBoolean(value.readBufferByte(offset) != 0);\n            case Byte -> JavaConstant.forByte(value.readBufferByte(offset));\n            case Short -> JavaConstant.forShort(value.readBufferShort(ByteOrder.nativeOrder(), offset));","sourceCodeStart":1025,"sourceCodeEnd":1061,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/espresso-compiler-stub/src/com.oracle.truffle.espresso.vmaccess/src/com/oracle/truffle/espresso/vmaccess/EspressoExternalVMAccess.java#L1025-L1061","documentation":"Error \"Expected a non-void primitive kind, got \" thrown in oracle/graal.","triggerScenarios":"Thrown at espresso-compiler-stub/src/com.oracle.truffle.espresso.vmaccess/src/com/oracle/truffle/espresso/vmaccess/EspressoExternalVMAccess.java:1043 when the library encounters an invalid state.","commonSituations":"Occurs when a caller violates the contract guarded by this check: Expected a non-void primitive kind, got","solutions":["Fix the condition reported by the error: Expected a non-void primitive kind, got","Check the throwing call site and ensure its documented preconditions (argument values, types, environment, or configuration) are satisfied before the call."],"exampleFix":"Validate inputs and environment so that the failing condition does not occur: Expected a non-void primitive kind, got","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}