apache/hadoop · error · IOException
create: Pathname too long. Limit {} characters, {} levels.
Error message
create: Pathname too long. Limit {} characters, {} levels. What it means
Error "create: 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:819
@Override // ClientProtocol
public FsServerDefaults getServerDefaults() throws IOException {
checkNNStartup();
return namesystem.getServerDefaults();
}
@Override // ClientProtocol
public HdfsFileStatus create(String src, FsPermission masked,
String clientName, EnumSetWritable<CreateFlag> flag,
boolean createParent, short replication, long blockSize,
CryptoProtocolVersion[] supportedVersions, String ecPolicyName,
String storagePolicy)
throws IOException {
checkNNStartup();
String clientMachine = getClientMachine();
stateChangeLog.debug("*DIR* NameNode.create: file {} for {} at {}.",
src, clientName, clientMachine);
if (!checkPathLength(src)) {
throw new IOException("create: Pathname too long. Limit "
+ MAX_PATH_LENGTH + " characters, " + MAX_PATH_DEPTH + " levels.");
}
namesystem.checkOperation(OperationCategory.WRITE);
CacheEntryWithPayload cacheEntry = getCacheEntryWithPayload(null);
if (cacheEntry != null && cacheEntry.isSuccess()) {
return (HdfsFileStatus) cacheEntry.getPayload();
}
HdfsFileStatus status = null;
try {
PermissionStatus perm = new PermissionStatus(getRemoteUser()
.getShortUserName(), null, masked);
status = namesystem.startFile(src, perm, clientName, clientMachine,
flag.get(), createParent, replication, blockSize, supportedVersions,
ecPolicyName, storagePolicy, cacheEntry != null);
} finally {
RetryCache.setState(cacheEntry, status != null, status);
}View on GitHub (pinned to 2add963021)
Solutions
- Shorten the path or filename, or raise dfs.namenode.fs-limits.max-component-length / max-directory-items limits if appropriate.
When it happens
Trigger: A create call uses a pathname exceeding the configured character or depth limits.
Common situations: Creating deeply nested paths or very long file names beyond default HDFS limits.
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/808187f223ddd859.
Report an issue: GitHub.