{"record":{"id":"345b029fff25364a","repo":"prestodb/presto","slug":"parse-error-connectortablelayouthandle-connecto","errorCode":null,"errorMessage":"{parse_error} ConnectorTableLayoutHandle  ConnectorTableLayoutHandle","messagePattern":"(.+?) ConnectorTableLayoutHandle  ConnectorTableLayoutHandle","errorType":"validation","errorClass":"ParseError","httpStatus":null,"severity":"error","filePath":"presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.cpp","lineNumber":6429,"sourceCode":"  }\n  getConnectorProtocol(type).from_json(j, p);\n}\n} // namespace facebook::presto::protocol\nnamespace facebook::presto::protocol {\nvoid to_json(json& j, const std::shared_ptr<ConnectorTableLayoutHandle>& p) {\n  if (p == nullptr) {\n    return;\n  }\n  String type = p->_type;\n  getConnectorProtocol(type).to_json(j, p);\n}\n\nvoid from_json(const json& j, std::shared_ptr<ConnectorTableLayoutHandle>& p) {\n  String type;\n  try {\n    type = p->getSubclassKey(j);\n  } catch (json::parse_error& e) {\n    throw ParseError(\n        std::string(e.what()) +\n        \" ConnectorTableLayoutHandle  ConnectorTableLayoutHandle\");\n  }\n\n  if (j.contains(\"customSerializedValue\")) {\n    VELOX_CHECK(\n        !type.empty() && type[0] != '$',\n        \"Internal handle type '{}' should not have customSerializedValue\",\n        type);\n    std::string binaryData = velox::encoding::Base64::decode(\n        j[\"customSerializedValue\"].get<std::string>());\n    getConnectorProtocol(type).deserialize(binaryData, p);\n    return;\n  }\n\n  getConnectorProtocol(type).from_json(j, p);\n}\n} // namespace facebook::presto::protocol","sourceCodeStart":6411,"sourceCodeEnd":6447,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.cpp#L6411-L6447","documentation":"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.","triggerScenarios":"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.","commonSituations":"Custom connectors with handle JSON containing unescaped characters; coordinator/worker version skew; network truncation of large plan payloads.","solutions":["Validate the offending JSON with a standalone parser to find the malformed bytes","Escape/serialize connector layout handles with a proper JSON encoder on the coordinator","Align coordinator and native worker protocol versions","Log the full JSON fragment and reproduce the parse failure in isolation"],"exampleFix":"// before\nproto::from_json(rawLayoutJson, layoutHandle);\n// after: pre-validate\njson j = json::parse(rawLayoutJson);\nassert(j.contains(\"type\"));\nproto::from_json(j, layoutHandle);","handlingStrategy":"validation","validationCode":"json j = json::parse(layoutHandleJson);\nif (!j.is_object() || !j.contains(\"type\")) {\n  throw std::runtime_error(\"ConnectorTableLayoutHandle JSON invalid: missing 'type'\");\n}","typeGuard":"bool isWellFormedLayoutHandleJson(const json& j) {\n  return j.is_object() && j.contains(\"type\") && j[\"type\"].is_string();\n}","tryCatchPattern":"try {\n  proto::from_json(j, layoutHandle);\n} catch (const ParseError& e) {\n  LOG(ERROR) << \"bad ConnectorTableLayoutHandle JSON: \" << e.what();\n  throw;\n}","preventionTips":["Pre-parse layout handle JSON to catch syntax errors early","Escape connector-provided strings via a JSON encoder, never string concatenation","Match coordinator/native protocol versions","Log failing fragments for reproduction"],"tags":["json","deserialization","parse-error","table-layout-handle"],"backgroundTag":"json-parse-error","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"}