apache/hadoop · error · FileAlreadyExistsException
Can't make directory for path '%s' since it is a file.
Error message
Can't make directory for path '%s' since it is a file.
What it means
Error "Can't make directory for path '%s' since it is a file." thrown in apache/hadoop.
Source
Thrown at hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/impl/MkdirOperation.java:192
private void verifyFileStatusOfClosestAncestor() throws IOException {
FileStatus fileStatus;
// Walk path to root, ensuring the closest ancestor is a directory, not file
Path fPart = dir.getParent();
try {
while (fPart != null && !fPart.isRoot()) {
fileStatus = getPathStatusExpectingDir(fPart);
if (fileStatus == null) {
// nothing at this path, so validate the parent
fPart = fPart.getParent();
continue;
}
if (fileStatus.isDirectory()) {
// the parent dir exists. All is good.
break;
}
// there's a file at the parent entry
throw new FileAlreadyExistsException(
String.format(
"Can't make directory for path '%s' since it is a file.",
fPart));
}
} catch (AccessDeniedException e) {
LOG.info("mkdirs({}}: Access denied when looking"
+ " for parent directory {}; skipping checks",
dir,
fPart);
LOG.debug("{}", e, e);
}
}
/**
* Get the status of a path, downgrading FNFE to null result.
* @param path path to probe.
* @param probes probes to exec
* @return the status or nullView on GitHub (pinned to 2add963021)
Solutions
- Remove or rename the conflicting file at the path, then create the directory.
When it happens
Trigger: Thrown at hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/impl/MkdirOperation.java:192 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/9110eac80728b5cd.
Report an issue: GitHub.