apache/hadoop · error · IOException
mkdirs: Pathname too long. Limit {} characters, {} levels.
Error message
mkdirs: Pathname too long. Limit {} characters, {} levels. What it means
Error "mkdirs: Pathname too long. Limit {} characters, {} levels." thrown in apache/hadoop.
Source
Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeRpcServer.java:1173
/**
* Check path length does not exceed maximum. Returns true if
* length and depth are okay. Returns false if length is too long
* or depth is too great.
*/
private boolean checkPathLength(String src) {
Path srcPath = new Path(src);
return (src.length() <= MAX_PATH_LENGTH &&
srcPath.depth() <= MAX_PATH_DEPTH);
}
@Override // ClientProtocol
public boolean mkdirs(String src, FsPermission masked, boolean createParent)
throws IOException {
checkNNStartup();
stateChangeLog.debug("*DIR* NameNode.mkdirs: {}.", src);
if (!checkPathLength(src)) {
throw new IOException("mkdirs: Pathname too long. Limit "
+ MAX_PATH_LENGTH + " characters, " + MAX_PATH_DEPTH + " levels.");
}
return namesystem.mkdirs(src,
new PermissionStatus(getRemoteUser().getShortUserName(),
null, masked), createParent);
}
@Override // ClientProtocol
public void renewLease(String clientName, List<String> namespaces)
throws IOException {
if (namespaces != null && namespaces.size() > 0) {
LOG.warn("namespaces({}) should be null or empty "
+ "on NameNode side, please check it.", namespaces);
throw new IOException("namespaces(" + namespaces
+ ") should be null or empty");
}
checkNNStartup();
namesystem.renewLease(clientName); View on GitHub (pinned to 2add963021)
Solutions
- Use a shorter directory path within configured limits when calling mkdirs.
When it happens
Trigger: mkdirs is called with a pathname exceeding configured character or depth limits.
Common situations: Creating very deep or long directory paths with hdfs dfs -mkdir -p.
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/e77231df4a09ed47.
Report an issue: GitHub.