apache/hadoop · error · PathIOException
Input/output error
Error message
Input/output error
What it means
Thrown by Mkdir.processNonexistentPath (Mkdir.java:88) when FileSystem.mkdirs(path) returns false instead of throwing. PathIOException's default message is 'Input/output error'. A false return means the filesystem declined the creation without an exception, so the shell cannot report the real cause (contrast the comment in Rename: 'we have no way to know the actual error...').
Source
Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Mkdir.java:88
protected void processNonexistentPath(PathData item) throws IOException {
if (!createParents) {
// check if parent exists. this is complicated because getParent(a/b/c/) returns a/b/c, but
// we want a/b
final Path itemPath = new Path(item.path.toString());
final Path itemParentPath = itemPath.getParent();
if(itemParentPath == null) {
throw new PathNotFoundException(String.format(
"Item: %s parent's path is null. This can happen if mkdir is " +
"called on root, so there's no parent.", itemPath.toString()));
}
if (!item.fs.exists(itemParentPath)) {
throw new PathNotFoundException(itemParentPath.toString());
}
}
if (!item.fs.mkdirs(item.path)) {
throw new PathIOException(item.toString());
}
}
}
View on GitHub (pinned to 2add963021)
Solutions
- Verify write permission on the parent directory ('hadoop fs -ls <parent>') and fix ownership/permissions or run as the right user
- Check NameNode logs for the real reason (quota exceeded, lease, safe mode) since the shell error carries no detail
- Confirm the path is not occupied by a file: 'hadoop fs -ls <path>'
- Retry after the transient condition (safe mode exit, concurrent job finishing) is resolved
Example fix
# diagnose: the shell gives no detail, so ask the FS directly hadoop fs -ls /data # check parent perms hdfs dfsadmin -safemode get # check safe mode hdfs dfsadmin -setQuota /data 100000 # if namespace quota was hit
Defensive patterns
Strategy: try-catch
Validate before calling
// pre-flight: permission + path state
if (!fs.exists(parent) || fs.getFileStatus(parent).isDirectory() == false) throw new IllegalStateException("bad parent"); Try / catch
catch (PathIOException e) { log path + inspect NN logs for the real cause (perms/quota/safe mode); resolve root cause before retrying; do not blind-retry in a tight loop } Prevention
- Grant WRITE on the parent directory to the invoking user
- Watch namespace quotas on target directories
- Avoid concurrent create/delete of the same tree
When it happens
Trigger: item.fs.mkdirs(item.path) returning false: no write permission on the parent directory in some FileSystem implementations, the parent being deleted concurrently between the exists() check and mkdirs(), a file appearing at the same path, or filesystem-specific failures (quota, namespace limits) surfaced as false rather than IOException.
Common situations: HDFS permissions where the invoking user lacks WRITE on the parent; concurrent jobs creating/deleting the same tree; small quotas (namespace quota exceeded surfaces differently across versions); hitting this with -p where the parent check is skipped but the FS still refuses creation.
Related errors
- No such file or directory
- Input/output error
- Cannot create directory {rootPath}
- Destination '{parentFile}' directory cannot be created
- Destination '{parentFile}' directory cannot be created
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/fe698ff310385840.
Report an issue: GitHub.