{"record":{"id":"469c052674899029","repo":"prestodb/presto","slug":"columnhandle-columnhandle","errorCode":null,"errorMessage":" ColumnHandle  ColumnHandle","messagePattern":" ColumnHandle  ColumnHandle","errorType":"exception","errorClass":"ParseError","httpStatus":null,"severity":"error","filePath":"presto-native-execution/presto_cpp/presto_protocol/connector/arrow_flight/presto_protocol_arrow_flight.cpp","lineNumber":146,"sourceCode":"  if (p == nullptr) {\n    return;\n  }\n  String type = p->_type;\n\n  if (type == \"arrow-flight\") {\n    j = *std::static_pointer_cast<ArrowColumnHandle>(p);\n    return;\n  }\n\n  throw TypeError(type + \" no abstract type ColumnHandle \");\n}\n\nvoid from_json(const json& j, std::shared_ptr<ColumnHandle>& p) {\n  String type;\n  try {\n    type = p->getSubclassKey(j);\n  } catch (json::parse_error& e) {\n    throw ParseError(std::string(e.what()) + \" ColumnHandle  ColumnHandle\");\n  }\n\n  if (type == \"arrow-flight\") {\n    std::shared_ptr<ArrowColumnHandle> k =\n        std::make_shared<ArrowColumnHandle>();\n    j.get_to(*k);\n    p = std::static_pointer_cast<ColumnHandle>(k);\n    return;\n  }\n\n  throw TypeError(type + \" no abstract type ColumnHandle \");\n}\n} // namespace facebook::presto::protocol::arrow_flight\nnamespace facebook::presto::protocol::arrow_flight {\nArrowTableLayoutHandle::ArrowTableLayoutHandle() noexcept {\n  _type = \"arrow-flight\";\n}\n","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-native-execution/presto_cpp/presto_protocol/connector/arrow_flight/presto_protocol_arrow_flight.cpp#L128-L164","documentation":"This ParseError is thrown by from_json for std::shared_ptr<ColumnHandle> in the arrow_flight protocol serializer when p->getSubclassKey(j) throws an nlohmann::json::parse_error — meaning the input JSON is malformed or the discriminator field cannot be extracted. The catch block augments the parse message with \" ColumnHandle  ColumnHandle\" to indicate the failure occurred while resolving the ColumnHandle subclass discriminator.","triggerScenarios":"Calling from_json on a json value that is not a valid object (or is truncated/invalid JSON) when deserializing a shared_ptr<ColumnHandle>, so getSubclassKey cannot read the type field.","commonSituations":"Corrupt or hand-edited plan/protocol JSON payloads; a producer writing the ColumnHandle JSON with a different schema (missing \"@type\"/\"_type\" field); truncation of large plans in transport or logs.","solutions":["Validate the JSON payload parses and contains the subclass discriminator field before deserializing","Fix the producer so ColumnHandle JSON always includes the type key (e.g. \"@type\": \"arrow-flight\")","Catch ParseError at the plan-ingest boundary and return a clear protocol error to the coordinator instead of crashing"],"exampleFix":"// before\nstd::shared_ptr<ColumnHandle> p;\nfrom_json(maybeMalformedJson, p);\n// after\nif (!maybeMalformedJson.is_object() || !maybeMalformedJson.contains(\"@type\")) {\n  throw ParseError(\"ColumnHandle json missing @type discriminator\");\n}\nfrom_json(maybeMalformedJson, p);","handlingStrategy":"validation","validationCode":"// before from_json on a ColumnHandle\nif (!j.is_object()) {\n  throw ParseError(\"ColumnHandle json must be an object\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  from_json(j, columnHandle);\n} catch (const ParseError& e) {\n  LOG(ERROR) << \"Malformed ColumnHandle json: \" << e.what();\n  throw;\n}","preventionTips":["Validate plan JSON with a schema checker before deserialization","Never feed hand-edited or truncated JSON into the protocol layer","Keep coordinator and native protocol definitions in version lockstep","Include the raw payload hash in error reports to identify corrupt sources"],"tags":["json-parse","deserialization","arrow-flight"],"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"}