{"record":{"id":"d4bc04431e8530aa","repo":"prestodb/presto","slug":"decoder-conversion-not-supported-d4bc04","errorCode":"DECODER_CONVERSION_NOT_SUPPORTED","errorMessage":"could not parse value '%s' as '%s' for column '%s'","messagePattern":"could not parse value '(.+?)' as '(.+?)' for column '(.+?)'","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-record-decoder/src/main/java/com/facebook/presto/decoder/json/RFC2822JsonFieldDecoder.java","lineNumber":84,"sourceCode":"    }\n\n    public static class RFC2822JsonValueProvider\n            extends AbstractDateTimeJsonValueProvider\n    {\n        public RFC2822JsonValueProvider(JsonNode value, DecoderColumnHandle columnHandle)\n        {\n            super(value, columnHandle);\n        }\n\n        @Override\n        protected long getMillis()\n        {\n            if (value.isValueNode()) {\n                try {\n                    return FORMATTER.parseMillis(value.asText());\n                }\n                catch (IllegalArgumentException e) {\n                    throw new PrestoException(\n                            DECODER_CONVERSION_NOT_SUPPORTED,\n                            format(\"could not parse value '%s' as '%s' for column '%s'\", value.asText(), columnHandle.getType(), columnHandle.getName()));\n                }\n            }\n            throw new PrestoException(\n                    DECODER_CONVERSION_NOT_SUPPORTED,\n                    format(\"could not parse non-value node as '%s' for column '%s'\", columnHandle.getType(), columnHandle.getName()));\n        }\n    }\n}\n","sourceCodeStart":66,"sourceCodeEnd":95,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-record-decoder/src/main/java/com/facebook/presto/decoder/json/RFC2822JsonFieldDecoder.java#L66-L95","documentation":"RFC2822JsonFieldDecoder.getMillis parses the JSON value's text with a DateTimeFormatter for RFC 2822 date strings (e.g. 'Tue, 10 Jun 2003 04:00:00 GMT'). An IllegalArgumentException from the parser (unparseable text) is caught and rethrown as PrestoException(DECODER_CONVERSION_NOT_SUPPORTED) with the message \"could not parse value '%s' as '%s' for column '%s'\". It indicates the field content is not a valid RFC 2822 date.","triggerScenarios":"Column with dataFormat 'rfc2822' where the mapped JSON value node's text is not RFC2822, e.g. '{\"date\": \"2024-01-01\"}' (ISO) or '{\"date\": \"1704067200\"}' (epoch); FORMATTER.parseMillis throws IllegalArgumentException during getMillis on query execution.","commonSituations":"Producer emits ISO-8601 or epoch values while the table was defined with the rfc2822 decoder; email-style headers changed format; locale/zone suffixes missing from the date string.","solutions":["Make the producer emit RFC 2822 dates (e.g. 'Tue, 10 Jun 2003 04:00:00 GMT').","Switch the column dataFormat to 'iso8601' or 'milliseconds-since-epoch' to match the actual payload format.","Transform the field upstream to RFC 2822 before it reaches the topic.","Read the field as varchar and convert with Presto's date_parse/from_unixtime functions instead."],"exampleFix":"// before: rfc2822 decoder on ISO payload -> parse failure\n-- sent_at TIMESTAMP WITH TIME ZONE WITH (data_format='rfc2822', mapping='date')\n// after: use the decoder matching the wire format\n-- sent_at TIMESTAMP WITH TIME ZONE WITH (data_format='iso8601', mapping='date')","handlingStrategy":"validation","validationCode":"// Validate the date string looks RFC2822 before relying on the decoder:\nboolean isRfc2822(String v) {\n  return v != null && v.matches(\"[A-Za-z]{3}, \\\\d{1,2} [A-Za-z]{3} \\\\d{4} \\\\d{2}:\\\\d{2}:\\\\d{2} (GMT|[+-]\\\\d{4})\");\n}","typeGuard":null,"tryCatchPattern":"try (ResultSet rs = stmt.executeQuery(sql)) { ... } catch (SQLException e) { if (e.getMessage().contains(\"could not parse value\") && e.getMessage().contains(\"rfc\")) { switchColumnToIso8601(); } else throw e; }","preventionTips":["Match the decoder to the wire format: rfc2822 only for email-style date headers.","Verify date formats with a one-row SELECT against a test topic before production.","Centralize timestamp format decisions with the producing team."],"tags":["presto","kafka-decoder","json","rfc2822","date-parsing"],"backgroundTag":"timestamp-parse-failed","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"}