prestodb/presto · error · java.lang.IllegalArgumentException
Object '%s' does not match type %s
Error message
Object '%s' does not match type %s
What it means
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.
Source
Thrown at presto-common/src/main/java/com/facebook/presto/common/Utils.java:38
import jakarta.annotation.Nullable;
import java.util.function.Supplier;
import static com.facebook.presto.common.type.TypeUtils.readNativeValue;
import static com.facebook.presto.common.type.TypeUtils.writeNativeValue;
import static java.lang.String.format;
import static java.util.Objects.requireNonNull;
public final class Utils
{
private Utils()
{
}
public static Block nativeValueToBlock(Type type, Object object)
{
if (object != null && !Primitives.wrap(type.getJavaType()).isInstance(object)) {
throw new IllegalArgumentException(format("Object '%s' does not match type %s", object, type.getJavaType()));
}
BlockBuilder blockBuilder = type.createBlockBuilder(null, 1);
writeNativeValue(type, blockBuilder, object);
return blockBuilder.build();
}
public static Object blockToNativeValue(Type type, Block block)
{
return readNativeValue(type, block, 0);
}
public static void checkArgument(boolean expression)
{
if (!expression) {
throw new IllegalArgumentException();
}
}
View on GitHub (pinned to 55bb57d202)
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
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at presto-common/src/main/java/com/facebook/presto/common/Utils.java:38 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/ece4cbf66dc5e8fa.
Report an issue: GitHub.