{"record":{"id":"555cf2dd50eb9f13","repo":"apache/flink","slug":"exactly-one-of-localdate-and-localtime-is-null","errorCode":null,"errorMessage":"Exactly one of LocalDate and LocalTime is null.","messagePattern":"Exactly one of LocalDate and LocalTime is null\\.","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"flink-core/src/main/java/org/apache/flink/api/common/typeutils/base/LocalDateTimeSerializer.java","lineNumber":84,"sourceCode":"    @Override\n    public void serialize(LocalDateTime record, DataOutputView target) throws IOException {\n        if (record == null) {\n            LocalDateSerializer.INSTANCE.serialize(null, target);\n            LocalTimeSerializer.INSTANCE.serialize(null, target);\n        } else {\n            LocalDateSerializer.INSTANCE.serialize(record.toLocalDate(), target);\n            LocalTimeSerializer.INSTANCE.serialize(record.toLocalTime(), target);\n        }\n    }\n\n    @Override\n    public LocalDateTime deserialize(DataInputView source) throws IOException {\n        LocalDate localDate = LocalDateSerializer.INSTANCE.deserialize(source);\n        LocalTime localTime = LocalTimeSerializer.INSTANCE.deserialize(source);\n        if (localDate == null && localTime == null) {\n            return null;\n        } else if (localDate == null || localTime == null) {\n            throw new IOException(\"Exactly one of LocalDate and LocalTime is null.\");\n        } else {\n            return LocalDateTime.of(localDate, localTime);\n        }\n    }\n\n    @Override\n    public LocalDateTime deserialize(LocalDateTime reuse, DataInputView source) throws IOException {\n        return deserialize(source);\n    }\n\n    @Override\n    public void copy(DataInputView source, DataOutputView target) throws IOException {\n        LocalDateSerializer.INSTANCE.copy(source, target);\n        LocalTimeSerializer.INSTANCE.copy(source, target);\n    }\n\n    @Override\n    public TypeSerializerSnapshot<LocalDateTime> snapshotConfiguration() {","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/api/common/typeutils/base/LocalDateTimeSerializer.java#L66-L102","documentation":"LocalDateTimeSerializer splits a LocalDateTime into a LocalDate and a LocalTime and serializes each with its own singleton serializer. On deserialize it reconstructs the pair; the guard rejects the case where exactly one component is null, since that indicates inconsistent/null markers rather than a legitimate null LocalDateTime (both null).","triggerScenarios":"Deserializing a LocalDateTime from a stream where exactly one of the LocalDate/LocalTime components decoded as null while the other did not — typically stream corruption or a serializer mismatch.","commonSituations":"Corrupted checkpoint/savepoint bytes; a custom serialization path that wrote inconsistent null markers for the date and time halves; a version skew where LocalDateSerializer/LocalTimeSerializer null handling changed; partial write or truncation of the state stream.","solutions":["Verify the data was written with a compatible LocalDateTimeSerializer version (check serializer snapshot compatibility logs at restore).","If you have a custom serialization path writing these components, ensure both the date and time halves are written or omitted together.","Inspect the restore logs for a serializer schema mismatch (resolveSchemaCompatibility) between writer and reader.","If the checkpoint data is corrupt, discard the savepoint and restart from a known-good state.","Reproduce on a clean job to rule out stream truncation from network/disk errors."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    LocalDateTime value = LocalDateTimeSerializer.INSTANCE.deserialize(source);\n} catch (IOException e) {\n    if (e.getMessage().contains(\"LocalDate and LocalTime is null\")) {\n        log.error(\"Inconsistent LocalDateTime stream: one of date/time decoded as null; data is corrupt or serializer version mismatched\");\n    }\n    throw e;\n}","preventionTips":["Ensure writer and reader use the same LocalDateTimeSerializer version.","Do not hand-write custom serialization for LocalDateTime components; let the framework handle it.","Treat serializer schema warnings at restore as errors in CI.","Keep checkpoints on durable storage and validate checksums to avoid corruption."],"tags":["serialization","datetime","corrupt-data"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}