{"record":{"id":"a1b632657c80b608","repo":"apache/flink","slug":"unable-to-deserialize-message","errorCode":null,"errorMessage":"Unable to deserialize message","messagePattern":"Unable to deserialize message","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"flink-core/src/main/java/org/apache/flink/api/common/serialization/TypeInformationSerializationSchema.java","lineNumber":94,"sourceCode":"            TypeInformation<T> typeInfo, TypeSerializer<T> serializer) {\n        this.typeInfo = checkNotNull(typeInfo, \"typeInfo\");\n        this.serializer = checkNotNull(serializer, \"serializer\");\n    }\n\n    // ------------------------------------------------------------------------\n\n    @Override\n    public T deserialize(byte[] message) {\n        if (dis != null) {\n            dis.setBuffer(message);\n        } else {\n            dis = new DataInputDeserializer(message);\n        }\n\n        try {\n            return serializer.deserialize(dis);\n        } catch (IOException e) {\n            throw new RuntimeException(\"Unable to deserialize message\", e);\n        }\n    }\n\n    /**\n     * This schema never considers an element to signal end-of-stream, so this method returns always\n     * false.\n     *\n     * @param nextElement The element to test for the end-of-stream signal.\n     * @return Returns false.\n     */\n    @Override\n    public boolean isEndOfStream(T nextElement) {\n        return false;\n    }\n\n    @Override\n    public byte[] serialize(T element) {\n        if (dos == null) {","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/api/common/serialization/TypeInformationSerializationSchema.java#L76-L112","documentation":"Thrown by TypeInformationSerializationSchema.deserialize when the underlying TypeSerializer.deserialize throws an IOException. This schema wraps a TypeSerializer to convert byte[] to T; if the bytes are malformed, truncated, or were serialized with an incompatible serializer, deserialization fails. The IOException is wrapped in a RuntimeException because the DeserializationSchema.deserialize contract does not declare checked exceptions.","triggerScenarios":"Feeding byte[] that was not produced by the same TypeSerializer (schema mismatch), truncated messages, or corrupted bytes to the deserialize method. The serializer attempts to read fields and hits an IOException (e.g. EOFException, unexpected data).","commonSituations":"Changing the type schema or serializer version without a migration snapshot; consuming messages from a source serialized by a different producer; network corruption; partial messages from a misbehaving source.","solutions":["Verify the byte[] was produced by a serializer compatible with the TypeInformation used to construct the schema.","If the schema changed, implement a TypeSerializerSnapshot for migration and ensure the source produces the new format.","Catch the RuntimeException at the operator level and route bad messages to a dead-letter side output instead of failing the job."],"exampleFix":"// before: raw deserialize can crash the job\n@Override\npublic T deserialize(byte[] message) {\n    return schema.deserialize(message); // throws RuntimeException on bad bytes\n}\n\n// after: catch and route to side output\ntry {\n    return schema.deserialize(message);\n} catch (RuntimeException e) {\n    ctx.output(deadLetterTag, message);\n    return null;\n}","handlingStrategy":"try-catch","validationCode":"// Validate message is non-null and non-empty before deserializing\nif (message == null || message.length == 0) {\n    return null; // or route to error handling\n}","typeGuard":null,"tryCatchPattern":"try {\n    return schema.deserialize(message);\n} catch (RuntimeException e) {\n    // route to dead-letter / side output instead of failing the pipeline\n    return null;\n}","preventionTips":["Ensure the producer and consumer use the same TypeSerializer/TypeInformation.","Implement TypeSerializerSnapshot for schema evolution compatibility.","Route deserialization failures to a side output rather than crashing the job."],"tags":["serialization","deserialization","io","schema-mismatch"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}