apache/hadoop · error · HttpGetFailedException
Image transfer servlet at " + url + " failed with status cod
Error message
Image transfer servlet at " + url + " failed with status code " + connection.getResponseCode() + "\nResponse message:\n" + connection.getResponseMessage()
What it means
Util.doGetUrl fetches from the NameNode's GetImageServlet (image transfer) for checkpoint/bootstrap and throws HttpGetFailedException when the HTTP status is not 200. The exception records the URL, status code and response message, and exposes the code programmatically via getResponseCode(), so the fix depends on the code: 404 wrong endpoint, 401/403 authentication, 5xx server-side servlet failure.
Source
Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/Util.java:171
/**
* Downloads the files at the specified url location into destination
* storage.
*/
public static MD5Hash doGetUrl(URL url, List<File> localPaths,
Storage dstStorage, boolean getChecksum, int timeout,
DataTransferThrottler throttler) throws IOException {
HttpURLConnection connection;
try {
connection = (HttpURLConnection)
connectionFactory.openConnection(url, isSpnegoEnabled);
} catch (AuthenticationException e) {
throw new IOException(e);
}
setTimeout(connection, timeout);
if (connection.getResponseCode() != HttpURLConnection.HTTP_OK) {
throw new HttpGetFailedException("Image transfer servlet at " + url +
" failed with status code " + connection.getResponseCode() +
"\nResponse message:\n" + connection.getResponseMessage(),
connection);
}
long advertisedSize;
String contentLength = connection.getHeaderField(CONTENT_LENGTH);
if (contentLength != null) {
advertisedSize = Long.parseLong(contentLength);
} else {
throw new IOException(CONTENT_LENGTH + " header is not provided " +
"by the namenode when trying to fetch " + url);
}
MD5Hash advertisedDigest = parseMD5Header(connection);
String fsImageName = connection
.getHeaderField(ImageServlet.HADOOP_IMAGE_EDITS_HEADER);
InputStream stream = connection.getInputStream();
View on GitHub (pinned to 2add963021)
Solutions
- Reproduce with curl -v on the exact URL from the message and inspect the status and body
- Verify dfs.namenode.http-address points at the active NameNode and is reachable from the checkpointer host
- On Kerberized clusters, confirm SPNEGO/keytab setup on both NameNode and checkpointer (verify with curl --negotiate -u :)
- Check the NameNode log at the same timestamp for the matching GetImageServlet error
Defensive patterns
Strategy: retry
Validate before calling
HttpURLConnection c = (HttpURLConnection) new URL(checkpointUrl).openConnection();
c.setConnectTimeout(5000);
c.setRequestMethod("HEAD");
if (c.getResponseCode() != 200) {
throw new IOException("checkpoint endpoint unhealthy (" + c.getResponseCode()
+ "): " + checkpointUrl);
} Try / catch
try {
Util.doGetUrl(url, dst, timeout, false, factory, throttler);
} catch (HttpGetFailedException e) {
switch (e.getResponseCode()) {
case 401: case 403: // fix SPNEGO/keytab config; do not retry
case 404: // wrong dfs.namenode.http-address; do not retry
default: // 5xx: backoff-and-retry a bounded number of times
}
} Prevention
- Health-check dfs.namenode.http-address with curl before scheduling checkpoints
- On Kerberized clusters, validate SPNEGO with curl --negotiate -u : from the checkpointer host
- Retry only 5xx/transient codes; 401/403/404 are configuration errors and never self-heal
- Time-align NameNode logs with checkpoint failures to find the servlet-side cause
When it happens
Trigger: Secondary/Backup/Standby NameNode fetching an fsimage with a wrong dfs.namenode.http-address (404); Kerberos/SPNEGO not configured between checkpointer and NN (401/403); GetImageServlet rejecting malformed query params; NN still starting or in a bad state (5xx); a proxy in front of the NN mangling the request.
Common situations: Misconfigured dfs.namenode.http-address or dfs.namenode.backup.address; Kerberized cluster where the 2NN lacks a keytab/krb5.conf; firewall or redirect through a proxy; NN restarting while a checkpoint fires.
Related errors
- Image uploading failed, status: %d, url: %s, message: %s
- The length of the feature flag section was negative at {} by
- Security is enabled but block access tokens (via dfs.block.a
- Content-Length header is not provided by the namenode when t
- Fetch of url failed with status code connection.getResponseC
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/22dfece296689b66.
Report an issue: GitHub.