prestodb/presto · error · ParseError
{parse_error} ConnectorMergeTableHandle ConnectorMergeTable
Error message
{parse_error} ConnectorMergeTableHandle ConnectorMergeTableHandle What it means
This ParseError is thrown while deserializing JSON into a shared_ptr<ConnectorMergeTableHandle>. Here a JsonEncodedSubclass key reader raises json::parse_error while extracting the subclass key, re-thrown as ParseError labeled 'ConnectorMergeTableHandle'. The merge handle JSON (used for MERGE/MERGE-DELETE plans) is syntactically invalid before connector-protocol dispatch.
Source
Thrown at presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.cpp:7578
// UPDATE/MERGE deserialization on the worker (MergeHandle.from_json ->
// from_json_key(connectorMergeTableHandle) reaches here). Unlike the Delete/
// Insert handles there is no deserialize(ConnectorMergeTableHandle) overload
// on ConnectorProtocol, so the customSerializedValue branch is omitted.
void to_json(json& j, const std::shared_ptr<ConnectorMergeTableHandle>& p) {
if (p == nullptr) {
return;
}
String type = p->_type;
getConnectorProtocol(type).to_json(j, p);
}
void from_json(const json& j, std::shared_ptr<ConnectorMergeTableHandle>& p) {
String type;
try {
JsonEncodedSubclass keyReader;
type = keyReader.getSubclassKey(j);
} catch (json::parse_error& e) {
throw ParseError(
std::string(e.what()) +
" ConnectorMergeTableHandle ConnectorMergeTableHandle");
}
getConnectorProtocol(type).from_json(j, p);
}
} // namespace facebook::presto::protocol
namespace facebook::presto::protocol {
MergeHandle::MergeHandle() noexcept {
_type = "MergeHandle";
}
void to_json(json& j, const MergeHandle& p) {
j = json::object();
j["@type"] = "MergeHandle";
to_json_key(
j,
"tableHandle",View on GitHub (pinned to 55bb57d202)
Solutions
- Check that native execution supports the MERGE protocol version in use; align coordinator and native worker versions
- Validate the merge handle JSON fragment with a standalone parser to find the syntax error
- Fix the connector-side ConnectorMergeTableHandle JSON encoding
- Log the full plan JSON for the MERGE statement and reproduce the parse in isolation
Example fix
// before
proto::from_json(mergeHandleJson, mergeHandle);
// after
json j = json::parse(mergeHandleJson);
if (!j.contains("type")) throw std::runtime_error("missing merge handle type");
proto::from_json(j, mergeHandle); Defensive patterns
Strategy: validation
Validate before calling
json j = json::parse(mergeHandleJson);
if (!j.is_object() || !j.contains("type")) {
throw std::runtime_error("ConnectorMergeTableHandle JSON invalid: missing 'type'");
}
// also confirm native side supports the merge protocol
if (!supportsMergeProtocol()) throw std::runtime_error("native merge protocol not supported"); Type guard
bool isWellFormedMergeHandleJson(const json& j) {
return j.is_object() && j.contains("type") && j["type"].is_string();
} Try / catch
try {
proto::from_json(j, mergeHandle);
} catch (const ParseError& e) {
LOG(ERROR) << "bad ConnectorMergeTableHandle JSON: " << e.what();
throw;
} Prevention
- Confirm native worker supports the MERGE protocol version in use
- Validate merge handle JSON before deserialization
- Align coordinator/native versions when enabling MERGE
- Check connector merge-handle serialization
When it happens
Trigger: from_json invoked when deserializing a MERGE plan fragment whose ConnectorMergeTableHandle JSON is malformed; the JsonEncodedSubclass key extraction fails before getConnectorProtocol(type) dispatch.
Common situations: Running MERGE statements with a coordinator/native version mismatch (merge support newer on one side); connector with broken merge-handle serialization; corrupted plan JSON.
Understand the failure class
Background: JSON parse error: "Unexpected token" / "not valid JSON" / "failed to parse" — what JSON parsers are really complaining about — this error's family across 45 libraries.
Related errors
- {parse_error} ConnectorIndexHandle ConnectorIndexHandle
- {parse_error} ColumnHandle ColumnHandle
- {parse_error} ConnectorTableLayoutHandle ConnectorTableLayo
- {parse_error} ConnectorInsertTableHandle ConnectorInsertTab
- (JsonMappingException cause message)
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/14e5a865cb63fa09.
Report an issue: GitHub.