prestodb/presto · error · PrestoException

NOT_SUPPORTED

NOT_SUPPORTED

Error message

Can not serialize instance to bytes

What it means

ThriftCodecWrapper.toBytes failed to encode the instance into the Thrift binary protocol; the underlying ThriftProtocolException is wrapped. The object does not conform to the Thrift schema used for wire serialization.

Source

Thrown at presto-main/src/main/java/com/facebook/presto/server/thrift/ThriftCodecWrapper.java:63

        return new ThriftCodecWrapper<>(codec);
    }

    public static <T> ThriftCodec<T> unwrapThriftCodec(Codec<T> codec)
    {
        verify(codec instanceof ThriftCodecWrapper);
        return ((ThriftCodecWrapper<T>) codec).thriftCodec;
    }

    @Override
    public byte[] toBytes(T instance)
    {
        try {
            SliceOutput sliceOutput = new DynamicSliceOutput(1024);
            ThriftProtocolUtils.write(instance, thriftCodec, Protocol.BINARY, sliceOutput);
            return sliceOutput.slice().getBytes();
        }
        catch (ThriftProtocolException e) {
            throw new PrestoException(NOT_SUPPORTED, "Can not serialize instance to bytes", e);
        }
    }

    @Override
    public T fromBytes(byte[] bytes)
    {
        try {
            return ThriftProtocolUtils.read(thriftCodec, Protocol.BINARY, Slices.wrappedBuffer(bytes).getInput());
        }
        catch (ThriftProtocolException e) {
            throw new PrestoException(NOT_SUPPORTED, "Can not deserialize instance from bytes", e);
        }
    }

    @Override
    public void writeBytes(OutputStream output, T instance)
    {
        throw new UnsupportedOperationException("Operation not supported");

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Verify the object type matches the codec's expected Thrift schema
  2. Check for nulls in required fields or enum values outside the defined Thrift IDs
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at presto-main/src/main/java/com/facebook/presto/server/thrift/ThriftCodecWrapper.java:63 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class

Background: Presto NOT_SUPPORTED error: what "not supported" means and how to fix it — this error's family across 3 libraries.


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/6a459cae0350555f. Report an issue: GitHub.