{"record":{"id":"84c7b27be6d6510c","repo":"oracle/graal","slug":"unsupported-array-value-s-value-type-s","errorCode":null,"errorMessage":"Unsupported array: Value: %s, Value type: %s","messagePattern":"Unsupported array: Value: (.+?), Value type: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/util/ObjectCopierOutputStream.java","lineNumber":201,"sourceCode":"                internalWritePackedSigned(Array.getInt(value, i));\n            }\n        } else if (compClz == long.class) {\n            internalWriteByte('J');\n            for (int i = 0; i < length; i++) {\n                internalWritePackedSigned(Array.getLong(value, i));\n            }\n        } else if (compClz == float.class) {\n            internalWriteByte('F');\n            for (int i = 0; i < length; i++) {\n                out.writeFloat(Array.getFloat(value, i));\n            }\n        } else if (compClz == double.class) {\n            internalWriteByte('D');\n            for (int i = 0; i < length; i++) {\n                out.writeDouble(Array.getDouble(value, i));\n            }\n        } else {\n            throw new IllegalArgumentException(String.format(\"Unsupported array: Value: %s, Value type: %s\", value, value.getClass()));\n        }\n        if (debugOut != null) {\n            for (int i = 0; i < length; i++) {\n                debugPrintValue(Array.get(value, i));\n            }\n        }\n    }\n\n    private static long encodeSign(long value) {\n        return (value << 1) ^ (value >> 63);\n    }\n\n    protected void internalWritePackedSigned(long value) throws IOException {\n        // this is a modified version of the SIGNED5 encoding from Pack200\n        writePacked(encodeSign(value));\n    }\n\n    public void writePackedUnsignedInt(int value) throws IOException {","sourceCodeStart":183,"sourceCodeEnd":219,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/util/ObjectCopierOutputStream.java#L183-L219","documentation":"IllegalArgumentException from ObjectCopierOutputStream's array-writing method: the value is an array whose component type is not one of the supported primitive components (boolean, byte, char, short, int, long, float, double as handled by the preceding branches, ending at double[]). The message includes the whole array value and its class, so even the failure report identifies the array type.","triggerScenarios":"Passing an Object[], String[], or an array of any reference component type to the copier's write path — compClz matches none of the primitive component branches and falls to the throw.","commonSituations":"Trying to copy state containing String[] (e.g. captured argument lists) or Object[] (varargs captures); assuming 'array' support means all arrays when only primitive arrays plus separately-handled scalars are supported.","solutions":["Convert reference arrays before copying: String[] can become a delimited String or be copied element-by-element as scalars; Object[] usually indicates the state is too rich for ObjectCopier.","Restructure the copied state to primitive arrays (int[], double[], ...) plus separate scalar entries.","Use a real serializer for object graphs; ObjectCopier is intentionally minimal for value snapshots.","Note the message prints the full array — avoid copying huge arrays in production paths where the exception text itself would be costly."],"exampleFix":"// before\nObjectCopier.copy(new String[]{\"a\",\"b\"}, out); // String[] unsupported\n\n// after\nObjectCopier.copy(String.join(\",\", new String[]{\"a\",\"b\"}), out); // scalar String","handlingStrategy":"type-guard","validationCode":"static boolean isCopierArray(Object v) {\n    return v != null && v.getClass().isArray()\n        && v.getClass().getComponentType().isPrimitive(); // only primitive arrays\n}\n\n// convert reference arrays before copying\nstatic Object toArraySafe(Object v) {\n    if (v instanceof String[] arr) return String.join(\"\\u0000\", arr);\n    return v;\n}","typeGuard":"static boolean isCopierArray(Object v) {\n    return v != null && v.getClass().isArray()\n        && v.getClass().getComponentType().isPrimitive();\n}","tryCatchPattern":null,"preventionTips":["Model lists of strings as a single delimited String, not String[].","Remember the array whitelist is primitive components only; Object[]/String[] are design errors, not encoding glitches.","Avoid copying huge arrays near code that may throw — the error message embeds the full array via Arrays.toString-style formatting."],"tags":["serialization","object-copier","arrays","illegal-argument"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}