prestodb/presto · error · ParseError

{parse_error} ConnectorTableLayoutHandle ConnectorTableLayo

Error message

{parse_error} ConnectorTableLayoutHandle  ConnectorTableLayoutHandle

What it means

This ParseError is thrown while deserializing JSON into a shared_ptr<ConnectorTableLayoutHandle>. The json::parse_error from reading the subclass key is re-thrown as ParseError labeled 'ConnectorTableLayoutHandle'. The layout-handle JSON is syntactically broken, so the concrete connector layout subclass cannot be resolved.

Source

Thrown at presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.cpp:6429

  }
  getConnectorProtocol(type).from_json(j, p);
}
} // namespace facebook::presto::protocol
namespace facebook::presto::protocol {
void to_json(json& j, const std::shared_ptr<ConnectorTableLayoutHandle>& p) {
  if (p == nullptr) {
    return;
  }
  String type = p->_type;
  getConnectorProtocol(type).to_json(j, p);
}

void from_json(const json& j, std::shared_ptr<ConnectorTableLayoutHandle>& p) {
  String type;
  try {
    type = p->getSubclassKey(j);
  } catch (json::parse_error& e) {
    throw ParseError(
        std::string(e.what()) +
        " ConnectorTableLayoutHandle  ConnectorTableLayoutHandle");
  }

  if (j.contains("customSerializedValue")) {
    VELOX_CHECK(
        !type.empty() && type[0] != '$',
        "Internal handle type '{}' should not have customSerializedValue",
        type);
    std::string binaryData = velox::encoding::Base64::decode(
        j["customSerializedValue"].get<std::string>());
    getConnectorProtocol(type).deserialize(binaryData, p);
    return;
  }

  getConnectorProtocol(type).from_json(j, p);
}
} // namespace facebook::presto::protocol

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Validate the offending JSON with a standalone parser to find the malformed bytes
  2. Escape/serialize connector layout handles with a proper JSON encoder on the coordinator
  3. Align coordinator and native worker protocol versions
  4. Log the full JSON fragment and reproduce the parse failure in isolation

Example fix

// before
proto::from_json(rawLayoutJson, layoutHandle);
// after: pre-validate
json j = json::parse(rawLayoutJson);
assert(j.contains("type"));
proto::from_json(j, layoutHandle);
Defensive patterns

Strategy: validation

Validate before calling

json j = json::parse(layoutHandleJson);
if (!j.is_object() || !j.contains("type")) {
  throw std::runtime_error("ConnectorTableLayoutHandle JSON invalid: missing 'type'");
}

Type guard

bool isWellFormedLayoutHandleJson(const json& j) {
  return j.is_object() && j.contains("type") && j["type"].is_string();
}

Try / catch

try {
  proto::from_json(j, layoutHandle);
} catch (const ParseError& e) {
  LOG(ERROR) << "bad ConnectorTableLayoutHandle JSON: " << e.what();
  throw;
}

Prevention

When it happens

Trigger: from_json on table layout JSON containing invalid syntax — unescaped quotes in a connector-provided layout handle, truncated payload, wrong charset — raised while parsing the key region.

Common situations: Custom connectors with handle JSON containing unescaped characters; coordinator/worker version skew; network truncation of large plan payloads.

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


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