apache/hadoop · error · IOException
Unable to create file: {file}, Aborting
Error message
Unable to create file: {file}, Aborting What it means
In create(), after changing to the parent directory, storeFileStream (STOR) did not get a positive preliminary reply, so the server refused to start the upload. Any stream handle is closed, the client disconnected, and create() fails with this IOException.
Source
Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/ftp/FTPFileSystem.java:356
throw new IOException("create(): Mkdirs failed to create: " + parent);
}
client.allocate(bufferSize);
// Change to parent directory on the server. Only then can we write to the
// file on the server by opening up an OutputStream. As a side effect the
// working directory on the server is changed to the parent directory of the
// file. The FTP client connection is closed when close() is called on the
// FSDataOutputStream.
client.changeWorkingDirectory(parent.toUri().getPath());
OutputStream outputStream = client.storeFileStream(file.getName());
if (!FTPReply.isPositivePreliminary(client.getReplyCode())) {
// The ftpClient is an inconsistent state. Must close the stream
// which in turn will logout and disconnect from FTP server
if (outputStream != null) {
IOUtils.closeStream(outputStream);
}
disconnect(client);
throw new IOException("Unable to create file: " + file + ", Aborting");
}
FSDataOutputStream fos = new FSDataOutputStream(outputStream, statistics) {
@Override
public void close() throws IOException {
super.close();
if (!client.isConnected()) {
throw new FTPException("Client not connected");
}
boolean cmdCompleted = client.completePendingCommand();
disconnect(client);
if (!cmdCompleted) {
throw new FTPException("Could not complete transfer, Reply Code - "
+ client.getReplyCode());
}
}
};
return fos;View on GitHub (pinned to 2add963021)
Solutions
- Verify the same user can upload manually: curl -T localfile ftp://user@host/dir/
- Check the target directory is writable: FsAction.WRITE in getFileStatus(dir).getPermission()
- Rule out disk-full or quota on the server
- Switch to passive mode: conf.set("fs.ftp.data.connection.mode", "PASSIVE_LOCAL_DATA_CONNECTION_MODE") if active mode is blocked
Defensive patterns
Strategy: try-catch
Validate before calling
Path parent = file.getParent();
if (fs.exists(parent)) {
FsPermission perm = fs.getFileStatus(parent).getPermission();
if (!perm.getUserAction().and(FsAction.WRITE).equals(FsAction.WRITE)) {
throw new IOException("No FTP write permission in " + parent);
}
}
FSDataOutputStream out = fs.create(file, true); Try / catch
try {
out = fs.create(file, true);
} catch (IOException e) {
if (e.getMessage() != null && e.getMessage().startsWith("Unable to create file")) {
// server refused STOR: surface context (permission/quota/firewall) instead of the raw text
throw new IOException("FTP server refused STOR for " + file, e);
}
throw e;
} Prevention
- Confirm the FTP account can upload one file manually before running jobs
- Ensure the target name is not already a directory on the server
- Check server disk/quota when create fails only for some paths or large files
When it happens
Trigger: FTP user lacks write permission in the target directory; the target name already exists as a directory; server disk full or quota exceeded; data connection mode blocked by firewall so the server rejects STOR upfront.
Common situations: Upload directories with restrictive ownership; disk-full FTP servers; active-mode data channels blocked by NAT/firewall (server refuses the transfer before it starts).
Related errors
- Unable to open file: {file}, Aborting
- create(): Mkdirs failed to create: {parent}
- Could not complete transfer, Reply Code - {replyCode}
- Could not complete transfer, Reply Code -
- mkdir of ${f} failed
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/d429698b19b186fa.
Report an issue: GitHub.