{"record":{"id":"e3b0ef81a675f8c5","repo":"prestodb/presto","slug":"parse-error-connectorindexhandle-connectorindexh","errorCode":null,"errorMessage":"{parse_error} ConnectorIndexHandle ConnectorIndexHandle","messagePattern":"(.+?) ConnectorIndexHandle ConnectorIndexHandle","errorType":"validation","errorClass":"ParseError","httpStatus":null,"severity":"error","filePath":"presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.cpp","lineNumber":6164,"sourceCode":"      \"VariableReferenceExpression\",\n      \"groupIdVariable\");\n}\n} // namespace facebook::presto::protocol\nnamespace facebook::presto::protocol {\nvoid to_json(json& j, const std::shared_ptr<ConnectorIndexHandle>& 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<ConnectorIndexHandle>& 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()) + \" ConnectorIndexHandle ConnectorIndexHandle\");\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\nnamespace facebook::presto::protocol {","sourceCodeStart":6146,"sourceCodeEnd":6182,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.cpp#L6146-L6182","documentation":"This ParseError is thrown while deserializing a JSON payload into a shared_ptr<ConnectorIndexHandle>. The nlohmann json parser failed while reading the subclass key via getSubclassKey(j), so the protocol layer wraps the raw json::parse_error and appends 'ConnectorIndexHandle' for context. It means the incoming JSON fragment is syntactically malformed, not semantically wrong.","triggerScenarios":"Calling from_json on a JSON object whose 'type'/key region for a ConnectorIndexHandle is truncated, contains invalid escape sequences, wrong encoding, or is not a well-formed JSON value; typically during deserialization of a TableScanNode/IndexSourceNode plan fragment from the coordinator.","commonSituations":"Coordinator and native worker protocol version mismatch producing a corrupted or hand-edited plan JSON; a custom connector emitting non-JSON bytes in customSerializedValue; HTTP truncation of the plan body.","solutions":["Capture the full raw plan JSON and validate it with a strict JSON parser to find the malformed span","Verify coordinator and native worker use the same Presto/sp protocol version","Check the connector's serialized ConnectorIndexHandle output for invalid escapes or partial writes","Re-run with the plan fragment logged (json.dump()) to isolate the exact field"],"exampleFix":"// before: passing a hand-trimmed fragment\nproto::from_json(trimmedJson, indexHandle);\n// after: validate the JSON parses before handing it to the protocol layer\nauto j = json::parse(planJson); // throws with byte offset if malformed\nproto::from_json(j, indexHandle);","handlingStrategy":"validation","validationCode":"json j;\ntry { j = json::parse(planFragmentJson); }\ncatch (const json::parse_error& e) {\n  throw std::runtime_error(std::string(\"malformed plan JSON: \") + e.what());\n}\nif (!j.is_object()) throw std::runtime_error(\"plan fragment must be a JSON object\");","typeGuard":"bool isValidJson(const std::string& s, json* out = nullptr) {\n  try { if (out) *out = json::parse(s); return true; }\n  catch (const json::parse_error&) { return false; }\n}","tryCatchPattern":"try {\n  proto::from_json(j, indexHandle);\n} catch (const ParseError& e) {\n  LOG(ERROR) << \"bad ConnectorIndexHandle JSON: \" << e.what() << \" payload=\" << j.dump();\n  throw;\n}","preventionTips":["Validate the full plan/split JSON with json::parse before protocol deserialization","Keep coordinator and native worker versions in lockstep","Never hand-edit or string-splice plan JSON","Log the raw fragment on failure for offline reproduction"],"tags":["json","deserialization","parse-error","presto-protocol"],"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"}