apache/hadoop · error · IOException
Version Mismatch (Expected: {}, Received: {} )
Error message
Version Mismatch (Expected: {}, Received: {} ) What it means
Every data-transfer connection (DFSClient to DataNode, DN to DN on the xfer port) starts each operation with a short protocol version, DATA_TRANSFER_VERSION. Receiver.readOp rejects any value that differs, throwing IOException with expected vs received before the op is even parsed.
Source
Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/datatransfer/Receiver.java:74
@InterfaceStability.Evolving
public abstract class Receiver implements DataTransferProtocol {
private final Tracer tracer;
protected DataInputStream in;
protected Receiver(Tracer tracer) {
this.tracer = tracer;
}
/** Initialize a receiver for DataTransferProtocol with a socket. */
protected void initialize(final DataInputStream in) {
this.in = in;
}
/** Read an Op. It also checks protocol version. */
protected final Op readOp() throws IOException {
final short version = in.readShort();
if (version != DataTransferProtocol.DATA_TRANSFER_VERSION) {
throw new IOException( "Version Mismatch (Expected: " +
DataTransferProtocol.DATA_TRANSFER_VERSION +
", Received: " + version + " )");
}
return Op.read(in);
}
private TraceScope continueTraceSpan(ByteString spanContextBytes,
String description) {
TraceScope scope = null;
SpanContext spanContext =
TraceUtils.byteStringToSpanContext(spanContextBytes);
if (spanContext != null) {
scope = tracer.newScope(description, spanContext);
}
return scope;
}
private TraceScope continueTraceSpan(ClientOperationHeaderProto header,View on GitHub (pinned to 2add963021)
Solutions
- Align the HDFS client and DataNode versions (rolling upgrades must step only through mutually compatible versions)
- Check DataNode logs for the peer address - if it is not an expected client/DN, find and stop whatever is connecting to the xfer port
- For custom clients, send the DATA_TRANSFER_VERSION constant of the cluster being targeted
Defensive patterns
Strategy: try-catch
Validate before calling
// Client-side preflight: refuse to run against a cluster whose version may differ String dnVersion = someDn.getHdfsBlockReportsVersionHint(); // e.g. via DataNode JMX VersionInfo // practical form: assert the client's Hadoop version equals the cluster's reported // version (jmx `Hadoop:service=DataNode,name=DataNodeInfo` -> Version) before heavy IO
Try / catch
try {
fs.open(path).read();
} catch (IOException e) {
if (e.getMessage() != null && e.getMessage().contains("Version Mismatch")) {
// data-transfer protocol skew: stop and align client/DN versions; do not retry
} else {
throw e;
}
} Prevention
- Pin client and cluster Hadoop versions; follow the documented upgrade order for rolling upgrades
- Watch DN logs for the peer address on version-mismatch errors to find the offending client
- Keep nothing else bound to or dialing dfs.datanode.data.port
When it happens
Trigger: A client or peer DataNode running a Hadoop build whose DATA_TRANSFER_VERSION differs from the serving DataNode; or a non-HDFS program connecting to dfs.datanode.data.port (default 9866) so its bytes decode as a bogus version.
Common situations: Version skew during rolling upgrades that skipped incompatible versions; downgraded clients; stray services or port scanners hitting the dataxceiver port; custom native clients hardcoding the wrong version.
Related errors
- Unknown op {} in data stream
- Cannot create a secured connection if DataNode listens on un
- Received %x instead of %x from client.
- BUG: The stored LV = {} is newer than the supported LV = {}
- Unexpected blockChecksumType '%s', expecting COMPOSITE_CRC
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/8820e4cd47a4879f.
Report an issue: GitHub.