{"record":{"id":"6a459cae0350555f","repo":"prestodb/presto","slug":"not-supported-6a459c","errorCode":"NOT_SUPPORTED","errorMessage":"Can not serialize instance to bytes","messagePattern":"Can not serialize instance to bytes","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-main/src/main/java/com/facebook/presto/server/thrift/ThriftCodecWrapper.java","lineNumber":63,"sourceCode":"        return new ThriftCodecWrapper<>(codec);\n    }\n\n    public static <T> ThriftCodec<T> unwrapThriftCodec(Codec<T> codec)\n    {\n        verify(codec instanceof ThriftCodecWrapper);\n        return ((ThriftCodecWrapper<T>) codec).thriftCodec;\n    }\n\n    @Override\n    public byte[] toBytes(T instance)\n    {\n        try {\n            SliceOutput sliceOutput = new DynamicSliceOutput(1024);\n            ThriftProtocolUtils.write(instance, thriftCodec, Protocol.BINARY, sliceOutput);\n            return sliceOutput.slice().getBytes();\n        }\n        catch (ThriftProtocolException e) {\n            throw new PrestoException(NOT_SUPPORTED, \"Can not serialize instance to bytes\", e);\n        }\n    }\n\n    @Override\n    public T fromBytes(byte[] bytes)\n    {\n        try {\n            return ThriftProtocolUtils.read(thriftCodec, Protocol.BINARY, Slices.wrappedBuffer(bytes).getInput());\n        }\n        catch (ThriftProtocolException e) {\n            throw new PrestoException(NOT_SUPPORTED, \"Can not deserialize instance from bytes\", e);\n        }\n    }\n\n    @Override\n    public void writeBytes(OutputStream output, T instance)\n    {\n        throw new UnsupportedOperationException(\"Operation not supported\");","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main/src/main/java/com/facebook/presto/server/thrift/ThriftCodecWrapper.java#L45-L81","documentation":"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.","triggerScenarios":"Thrown at presto-main/src/main/java/com/facebook/presto/server/thrift/ThriftCodecWrapper.java:63 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the object type matches the codec's expected Thrift schema","Check for nulls in required fields or enum values outside the defined Thrift IDs"],"exampleFix":null,"handlingStrategy":"try-catch","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"}