apache/hadoop · error · IOException
Unexpected Content-Length
Error message
Unexpected Content-Length
What it means
Error "Unexpected Content-Length" thrown in apache/hadoop.
Source
Thrown at hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsInputStream.java:747
}
}
// Case-2: 416 INVALID RANGE
if (!isHnsEnabled && INVALID_RANGE.equals(ere.getErrorCode())) {
// Need to rule out if the path is an explicit directory
checkIfDirPathInFNS();
}
}
// Default: propagate original error
throw new IOException(ex);
}
long bytesRead = op.getResult().getBytesReceived();
if (streamStatistics != null) {
streamStatistics.remoteBytesRead(bytesRead);
}
if (bytesRead > Integer.MAX_VALUE) {
throw new IOException("Unexpected Content-Length");
}
LOG.debug("HTTP request read bytes = {}", bytesRead);
bytesFromRemoteRead += bytesRead;
return (int) bytesRead;
}
/**
* Increment Read Operations.
*/
private void incrementReadOps() {
if (statistics != null) {
statistics.incrementReadOps(1);
}
}
/**
* Seek to given position in stream.
* @param n position to seek toView on GitHub (pinned to 2add963021)
Solutions
- Retry the read; this indicates the service or an intermediary returned a body length inconsistent with the Content-Length header.
- Capture the failing request/response with DEBUG logging and report if persistent.
When it happens
Trigger: An ABFS read response has a body size inconsistent with its Content-Length header.
Common situations: See trigger scenarios.
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/e3f5dfd6d412aaaf.
Report an issue: GitHub.