{"record":{"id":"ea7c8e33a85cec98","repo":"prestodb/presto","slug":"generic-internal-error-ea7c8e","errorCode":"GENERIC_INTERNAL_ERROR","errorMessage":"JsonPath type cannot be serialized","messagePattern":"JsonPath type cannot be serialized","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/type/JsonPathType.java","lineNumber":53,"sourceCode":"        super(new TypeSignature(NAME), JsonPath.class);\n    }\n\n    @Override\n    public Object getObjectValue(SqlFunctionProperties properties, Block block, int position)\n    {\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public void appendTo(Block block, int position, BlockBuilder blockBuilder)\n    {\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public BlockBuilder createBlockBuilder(BlockBuilderStatus blockBuilderStatus, int expectedEntries, int expectedBytesPerEntry)\n    {\n        throw new PrestoException(GENERIC_INTERNAL_ERROR, \"JsonPath type cannot be serialized\");\n    }\n\n    @Override\n    public BlockBuilder createBlockBuilder(BlockBuilderStatus blockBuilderStatus, int expectedEntries)\n    {\n        throw new PrestoException(GENERIC_INTERNAL_ERROR, \"JsonPath type cannot be serialized\");\n    }\n}\n","sourceCodeStart":35,"sourceCodeEnd":62,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/type/JsonPathType.java#L35-L62","documentation":"JsonPathType wraps compiled JSON path expressions used by JSON functions; like JoniRegexpType it is an opaque internal type with no block serialization. createBlockBuilder therefore always throws GENERIC_INTERNAL_ERROR 'JsonPath type cannot be serialized' when the engine tries to materialize a JSONPATH value.","triggerScenarios":"Any attempt to produce a block of JSONPATH values: selecting a jsonpath expression, exchanging it between stages, or storing it via a connector.","commonSituations":"Queries that SELECT or alias a JSONPATH value into the output; custom functions returning JSONPATH; attempts to persist json_path values in tables.","solutions":["Use JSONPATH values only inline as arguments to json functions","Return VARCHAR (the path text) from custom functions instead of JSONPATH","Avoid grouping/joining/exchanging expressions of type JSONPATH"],"exampleFix":"// before\nSELECT JSON_FORMAT('$[0]') -- materializing a jsonpath value directly\n// after\nSELECT json_extract(j, '$[0]') -- path used inline inside a json function","handlingStrategy":"validation","validationCode":"// JSONPATH values must stay inline; verify output types\n// DESCRIBE SELECT <jsonpath expr>; -- JSONPATH in output means the query will fail","typeGuard":null,"tryCatchPattern":"try {\n    return type.createBlockBuilder(status, expectedEntries, expectedBytes);\n} catch (PrestoException e) {\n    // JSONPATH cannot be serialized: rewrite query to use json functions inline\n    throw e;\n}","preventionTips":["Never project JSONPATH expressions into query output","Use json_extract/json_extract_scalar with inline paths","Return path text as VARCHAR from UDFs"],"tags":["presto","jsonpath","serialization","internal-error"],"backgroundTag":"type-not-serializable","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"}