{"record":{"id":"f541494dffb269d2","repo":"prestodb/presto","slug":"invalid-arguments-f54149","errorCode":"INVALID_ARGUMENTS","errorMessage":"Can not serialize remote split","messagePattern":"Can not serialize remote split","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/thrift/RemoteSplitCodec.java","lineNumber":46,"sourceCode":"\npublic class RemoteSplitCodec\n        implements ConnectorCodec<ConnectorSplit>\n{\n    private final Provider<ThriftCodecManager> thriftCodecManagerProvider;\n\n    public RemoteSplitCodec(Provider<ThriftCodecManager> thriftCodecManagerProvider)\n    {\n        this.thriftCodecManagerProvider = requireNonNull(thriftCodecManagerProvider, \"thriftCodecManagerProvider is null\");\n    }\n\n    @Override\n    public byte[] serialize(ConnectorSplit split)\n    {\n        try {\n            return toThrift((RemoteSplit) split, thriftCodecManagerProvider.get().getCodec(RemoteSplit.class));\n        }\n        catch (TProtocolException e) {\n            throw new PrestoException(INVALID_ARGUMENTS, \"Can not serialize remote split\", e);\n        }\n    }\n\n    @Override\n    public ConnectorSplit deserialize(byte[] bytes)\n    {\n        try {\n            return fromThrift(bytes, thriftCodecManagerProvider.get().getCodec(RemoteSplit.class));\n        }\n        catch (TProtocolException e) {\n            throw new PrestoException(INVALID_ARGUMENTS, \"Can not deserialize remote split\", e);\n        }\n    }\n}\n","sourceCodeStart":28,"sourceCodeEnd":61,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/thrift/RemoteSplitCodec.java#L28-L61","documentation":"RemoteSplitCodec.serialize converts a ConnectorSplit (cast to RemoteSplit) into a Thrift byte array for shipping to remote worker tasks. If the underlying Thrift encoding raises TProtocolException (e.g. a field value violates the Thrift protocol constraints), the codec wraps it in a PrestoException with code INVALID_ARGUMENTS, since a split that cannot be encoded is by definition malformed input.","triggerScenarios":"Calling serialize() with a ConnectorSplit that is not an instance of RemoteSplit (ClassCastException is not caught, but any TProtocolException raised by toThrift while encoding a RemoteSplit's fields triggers this).","commonSituations":"A RemoteSplit whose embedded byte payload or fields are corrupted or incompatible with the registered Thrift codec; mismatched Thrift library versions between coordinator and workers producing unencodable structures.","solutions":["Inspect the wrapped TProtocolException cause to identify which RemoteSplit field fails Thrift encoding","Verify the RemoteSplit was constructed with valid, Thrift-encodable fields (e.g. the serialized split bytes are well-formed)","Confirm the Thrift codec manager resolves the same RemoteSplit codec version across all nodes","Log the offending split's address/fields, drop or re-generate the split rather than retrying serialization"],"exampleFix":"// before\nreturn toThrift((RemoteSplit) split, thriftCodecManagerProvider.get().getCodec(RemoteSplit.class));\n// after\nif (!(split instanceof RemoteSplit)) {\n    throw new PrestoException(INVALID_ARGUMENTS, \"Expected RemoteSplit, got \" + split.getClass().getSimpleName());\n}\nRemoteSplit remoteSplit = (RemoteSplit) split;\nreturn toThrift(remoteSplit, thriftCodecManagerProvider.get().getCodec(RemoteSplit.class));","handlingStrategy":"validation","validationCode":"if (!(split instanceof RemoteSplit)) {\n    throw new PrestoException(INVALID_ARGUMENTS, \"serialize expects RemoteSplit, got \" + split.getClass().getName());\n}","typeGuard":"boolean isEncodableRemoteSplit(ConnectorSplit split) {\n    return split instanceof RemoteSplit;\n}","tryCatchPattern":"try {\n    byte[] bytes = codec.serialize(split);\n} catch (PrestoException e) {\n    if (INVALID_ARGUMENTS.equals(e.getErrorCode())) {\n        LOG.error(e, \"Dropping unserializable remote split\");\n        return; // do not retry; the split payload is malformed\n    }\n    throw e;\n}","preventionTips":["Always construct remote splits through the connector's RemoteSplit factory path","Log and inspect the TProtocolException cause chain when serialization fails","Keep Thrift and Presto versions identical across coordinator and workers","Never hand-edit or cache RemoteSplit byte payloads across versions"],"tags":["serialization","thrift","split","distributed-execution"],"backgroundTag":"thrift-serialization-failed","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"}