{"record":{"id":"ece4cbf66dc5e8fa","repo":"prestodb/presto","slug":"object-s-does-not-match-type-s","errorCode":null,"errorMessage":"Object '%s' does not match type %s","messagePattern":"Object '(.+?)' does not match type (.+?)","errorType":"exception","errorClass":"java.lang.IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"presto-common/src/main/java/com/facebook/presto/common/Utils.java","lineNumber":38,"sourceCode":"import jakarta.annotation.Nullable;\n\nimport java.util.function.Supplier;\n\nimport static com.facebook.presto.common.type.TypeUtils.readNativeValue;\nimport static com.facebook.presto.common.type.TypeUtils.writeNativeValue;\nimport static java.lang.String.format;\nimport static java.util.Objects.requireNonNull;\n\npublic final class Utils\n{\n    private Utils()\n    {\n    }\n\n    public static Block nativeValueToBlock(Type type, Object object)\n    {\n        if (object != null && !Primitives.wrap(type.getJavaType()).isInstance(object)) {\n            throw new IllegalArgumentException(format(\"Object '%s' does not match type %s\", object, type.getJavaType()));\n        }\n        BlockBuilder blockBuilder = type.createBlockBuilder(null, 1);\n        writeNativeValue(type, blockBuilder, object);\n        return blockBuilder.build();\n    }\n\n    public static Object blockToNativeValue(Type type, Block block)\n    {\n        return readNativeValue(type, block, 0);\n    }\n\n    public static void checkArgument(boolean expression)\n    {\n        if (!expression) {\n            throw new IllegalArgumentException();\n        }\n    }\n","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-common/src/main/java/com/facebook/presto/common/Utils.java#L20-L56","documentation":"Block conversion guard: the object passed to nativeValueToBlock is not an instance of the Java type the declared Type expects (e.g. a Long where a Slice is required), so it cannot be written into the block.","triggerScenarios":"Thrown at presto-common/src/main/java/com/facebook/presto/common/Utils.java:38 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the value producer and the declared Type agree on Java representation","Convert the object to the type's native Java class before conversion","Fix the type declaration used at the call site"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}