apache/hadoop · error · FileAlreadyExistsException
Failed to rename %s to %s, file already exists or not empty!
Error message
Failed to rename %s to %s, file already exists or not empty!
What it means
The primary ZombieJob constructor requires a non-null LoggedJob and throws IllegalArgumentException('job is null') otherwise. A ZombieJob is a simulated reincarnation of one specific dead job; without the logged job record there is nothing to simulate, so the guard fails fast. Because LoggedJob normally comes from deserializing a rumen JSON trace, a null usually means the trace lookup returned nothing rather than a caller explicitly passing null.
Source
Thrown at hadoop-cloud-storage-project/hadoop-bos/src/main/java/org/apache/hadoop/fs/bos/BaiduBosFileSystem.java:804
LOG.debug("Parent directory {} does not exist "
+ "or will be implicitly created during rename",
dstPath.getParent());
} else {
if (dstStatus.isDirectory()) {
dstPath = new Path(dstPath, srcPath.getName());
FileStatus status;
try {
status = getFileStatus(dstPath);
} catch (FileNotFoundException fnde) {
status = null;
}
if (status != null) {
if (status.isFile()) {
LOG.debug("Deleting existing destination "
+ "file {} before rename", dstPath);
delete(dstPath, false);
} else {
throw new FileAlreadyExistsException(
String.format(
"Failed to rename %s to %s, "
+ "file already exists or not empty!",
srcPath, dstPath));
}
}
} else {
LOG.debug("Deleting existing destination "
+ "file {} before rename", dstPath);
delete(dstPath, false);
}
}
store.rename(pathToKey(srcPath), pathToKey(dstPath),
srcStatus.isFile());
return true;
}
View on GitHub (pinned to 2add963021)
Solutions
- Null-check the LoggedJob obtained from the trace before constructing the ZombieJob and handle 'not found' explicitly (skip, or fail with your own contextual message).
- Validate the trace file is a real rumen JSON trace and actually contains the job you are looking for (inspect the top-level array/object).
- If you need a synthetic job without logged data, ZombieJob is the wrong tool — construct LoggedJob with minimal fields rather than passing null.
Example fix
// before
LoggedJob job = getJobByName(trace, jobName); // returns null when absent
JobStory story = new ZombieJob(job, cluster); // IllegalArgumentException
// after
LoggedJob job = getJobByName(trace, jobName);
if (job == null) {
throw new IOException("Job '" + jobName + "' not found in trace " + tracePath);
}
JobStory story = new ZombieJob(job, cluster); Defensive patterns
Strategy: validation
Validate before calling
static ZombieJob newZombieJob(LoggedJob job, ClusterStory cluster, long seed) {
if (job == null) {
throw new NoSuchElementException(
"No logged job to simulate; check the trace lookup");
}
return new ZombieJob(job, cluster, seed);
} Type guard
static boolean hasLoggedJob(LoggedJob job) {
return job != null;
} Prevention
- Null-check every LoggedJob obtained from trace lookups before constructing ZombieJob.
- Validate that the trace file is non-empty and contains the target job before replay loops.
- Distinguish 'job absent' (your error with context) from rumen's generic 'job is null'.
When it happens
Trigger: new ZombieJob(null, cluster, seed) or new ZombieJob(null, cluster); looking up a job in a trace by name/id, getting null back (job not found), and passing it straight to the constructor; JSON deserialization returning null for an absent record.
Common situations: Trace-driven simulators (Mumak) loading a job trace where the requested job index/id does not exist; empty or truncated rumen trace files; a Map over trace entries where a filter/null creeps in.
Related errors
- Truncate is not supported by BaiduBosFileSystem
- user accessKey and secretAccessKey should not be null
- NoSuchUpload
- Key '" + key + "' does not exist in BOS
- trigger bos rate limit for too many requests !!!
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/b0c3c57e2b48d235.
Report an issue: GitHub.