apache/hadoop · error · FileAlreadyExistsException
Path is a file: " + dir
Error message
Path is a file: " + dir
What it means
Error "Path is a file: " + dir" thrown in apache/hadoop.
Source
Thrown at hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/impl/MkdirOperation.java:139
if (dir.isRoot()) {
// fast exit for root.
return true;
}
// get the file status of the path.
// this is done even for a magic path, to avoid always issuing PUT
// requests. Doing that without a check wouild seem to be an
// optimization, but it is not because
// 1. PUT is slower than HEAD
// 2. Write capacity is less than read capacity on a shard
// 3. It adds needless entries in versioned buckets, slowing
// down subsequent operations.
FileStatus fileStatus = getPathStatusExpectingDir(dir);
if (fileStatus != null) {
if (fileStatus.isDirectory()) {
return true;
} else {
throw new FileAlreadyExistsException("Path is a file: " + dir);
}
}
// file status was null
// is the path magic?
// If so, we declare success without looking any further
if (isMagicPath) {
// Create the marker file immediately,
callbacks.createFakeDirectory(dir);
return true;
}
// if performance creation mode is set, no need to check
// whether the closest ancestor is dir.
if (!performanceMkdir) {
verifyFileStatusOfClosestAncestor();
}
View on GitHub (pinned to 2add963021)
Solutions
- Choose a different path for the directory; a file already exists at that location.
When it happens
Trigger: Thrown at hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/impl/MkdirOperation.java:139 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/ba45c6f4f29db1a4.
Report an issue: GitHub.