apache/hadoop · error · IOException
Can't make directory for path
Error message
Can't make directory for path "%s" under "%s".
What it means
Thrown by SFTPFileSystem.mkdirs when the SftpException raised while creating the directory (after cd into parent and mkdir) is wrapped. The path name and parent directory are interpolated from the E_MAKE_DIR_FORPATH format.
Solutions
- Create the parent directory first, or check permissions to create directories under the given parent.
- Verify the parent path on the SFTP server is a directory and writable.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown by SFTPFileSystem.mkdirs when the parent directory portion of the target path cannot be created on the SFTP server.
Common situations: See trigger scenarios.
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/fc4bac2511cbfe01.
Report an issue: GitHub.
Appendix: source
Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/sftp/SFTPFileSystem.java:338
} catch (SftpException e) {
throw new IOException(e);
}
Path absolute = makeAbsolute(workDir, file);
String pathName = absolute.getName();
if (!exists(client, absolute)) {
Path parent = absolute.getParent();
created =
(parent == null || mkdirs(client, parent, FsPermission.getDefault()));
if (created) {
String parentDir = parent.toUri().getPath();
boolean succeeded = true;
try {
final String previousCwd = client.pwd();
client.cd(parentDir);
client.mkdir(pathName);
client.cd(previousCwd);
} catch (SftpException e) {
throw new IOException(String.format(E_MAKE_DIR_FORPATH, pathName,
parentDir));
}
created = created & succeeded;
}
} else if (isFile(client, absolute)) {
throw new IOException(String.format(E_DIR_CREATE_FROMFILE, absolute));
}
return created;
}
/**
* Convenience method, so that we don't open a new connection when using this
* method from within another method. Otherwise every API invocation incurs
* the overhead of opening/closing a TCP connection.
* @throws IOException
*/
private boolean isFile(ChannelSftp channel, Path file) throws IOException {
try {View on GitHub (pinned to 2add963021)