{"record":{"id":"7f3a8ef45f671caf","repo":"prestodb/presto","slug":"generic-internal-error-7f3a8e","errorCode":"GENERIC_INTERNAL_ERROR","errorMessage":"RegExp type cannot be serialized","messagePattern":"RegExp type cannot be serialized","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/type/JoniRegexpType.java","lineNumber":53,"sourceCode":"        super(new TypeSignature(NAME), Regex.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, \"RegExp type cannot be serialized\");\n    }\n\n    @Override\n    public BlockBuilder createBlockBuilder(BlockBuilderStatus blockBuilderStatus, int expectedEntries)\n    {\n        throw new PrestoException(GENERIC_INTERNAL_ERROR, \"RegExp 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/JoniRegexpType.java#L35-L62","documentation":"JoniRegexpType represents compiled regular expressions used internally by LIKE and regexp functions. Compiled regex objects have no serializable block representation, so createBlockBuilder always throws GENERIC_INTERNAL_ERROR with 'RegExp type cannot be serialized'. Reaching this means the engine attempted to materialize or store a REGEXP-typed value, which is unsupported.","triggerScenarios":"Any execution path that calls createBlockBuilder on JoniRegexpType, e.g. attempting to output, store, group by, or serialize a REGEXP value (a value of the internal regexp type) in a result set or exchange.","commonSituations":"Queries that try to SELECT a regexp constant or pass regexp values through connectors/JDBC; custom functions returning REGEXP; engine/plugin code that wrongly treats REGEXP as a storable type.","solutions":["Do not select or store REGEXP-typed values; use them only as arguments to like/regexp functions","Cast or restructure the query so the regexp is created inline (e.g. inside like()) instead of materialized","If a plugin function returns REGEXP, change it to return VARCHAR"],"exampleFix":"// before\nSELECT like('abc', REGEXP_LIKE_PATTERN('a.*')) -- trying to materialize a regexp value\n// after\nSELECT like('abc', 'a.*') -- pattern supplied inline as varchar","handlingStrategy":"validation","validationCode":"// Do not surface REGEXP-typed expressions in output/storage positions\n// SQL guard: check the expression type before selecting\n// DESCRIBE SELECT <expr>; -- must not show regexp in output columns","typeGuard":null,"tryCatchPattern":"try {\n    return blockBuilderCreation(type);\n} catch (PrestoException e) {\n    // GENERIC_INTERNAL_ERROR: opaque type (regexp/jsonpath) cannot be materialized\n    // rewrite query to keep the value inline in function arguments\n    throw e;\n}","preventionTips":["Never SELECT, GROUP BY, or store REGEXP-typed values","Create regexp patterns inline within like()/regexp functions","Have custom functions return VARCHAR, not REGEXP"],"tags":["presto","regexp","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"}