{"record":{"id":"95c6bc53bc0b0dcd","repo":"oracle/graal","slug":"source-should-be-a-primitive-array-got","errorCode":null,"errorMessage":"Source should be a primitive array, got ","messagePattern":"Source should be a primitive array, 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":1027,"sourceCode":"        }\n        long size = bytes.getBufferSize();\n        byte[] result = new byte[Math.toIntExact(size)];\n        bytes.readBuffer(0, result, 0, result.length);\n        return result;\n    }\n\n    public boolean hasAnnotations(Value metaObject) {\n        return invokeJVMCIHelper(\"hasAnnotations\", metaObject).asBoolean();\n    }\n\n    @Override\n    public void copyMemory(JavaConstant src, int srcFrom, int srcTo, byte[] dst, int dstFrom) {\n        if (!(src instanceof EspressoExternalObjectConstant objectConstant)) {\n            throw new IllegalArgumentException(\"Expected an EspressoExternalObjectConstant, got \" + safeGetClass(src));\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        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)) {","sourceCodeStart":1009,"sourceCodeEnd":1045,"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#L1009-L1045","documentation":"Error \"Source should be a primitive array, 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:1027 when the library encounters an invalid state.","commonSituations":"Occurs when a caller violates the contract guarded by this check: Source should be a primitive array, got","solutions":["Fix the condition reported by the error: Source should be a primitive array, 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: Source should be a primitive array, 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"}