apache/hadoop · error · FileNotFoundException
Not an executable file: {}
Error message
Not an executable file: {} What it means
Shell.getQualifiedBinInner() found a filesystem entry at ${hadoopHome}/bin/<executable>, but java.io.File.isFile() reports it is not a regular file (a directory or special file), so it cannot be executed and FileNotFoundException with E_NOT_EXECUTABLE_FILE is thrown. The path resolves, but to the wrong kind of object.
Source
Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/Shell.java:675
throws FileNotFoundException {
String binDirText = "Hadoop bin directory ";
File bin = new File(hadoopHomeDir, "bin");
if (!bin.exists()) {
throw new FileNotFoundException(addOsText(binDirText + E_DOES_NOT_EXIST
+ ": " + bin));
}
if (!bin.isDirectory()) {
throw new FileNotFoundException(addOsText(binDirText + E_NOT_DIRECTORY
+ ": " + bin));
}
File exeFile = new File(bin, executable);
if (!exeFile.exists()) {
throw new FileNotFoundException(
addOsText(E_NO_EXECUTABLE + ": " + exeFile));
}
if (!exeFile.isFile()) {
throw new FileNotFoundException(
addOsText(E_NOT_EXECUTABLE_FILE + ": " + exeFile));
}
try {
return exeFile.getCanonicalFile();
} catch (IOException e) {
// this isn't going to happen, because of all the upfront checks.
// so if it does, it gets converted to a FNFE and rethrown
throw fileNotFoundException(e.toString(), e);
}
}
/**
* Fully qualify the path to a binary that should be in a known hadoop
* bin location. This is primarily useful for disambiguating call-outs
* to executable sub-components of Hadoop to avoid clashes with other
* executables that may be in the path. Caveat: this call doesn't
* just format the path to the bin directory. It also checks for file
* existence of the composed path. The output of this call should beView on GitHub (pinned to 2add963021)
Solutions
- Inspect the entry: ls -la "$HADOOP_HOME/bin/winutils.exe" — look for 'd' mode or dangling link
- If it is a directory, remove it and place the real binary file at that exact path
- Repair or replace symlinks so they resolve to a regular file
- Re-copy bin/ from a trusted archive and verify with test -f "$HADOOP_HOME/bin/winutils.exe"
Example fix
# before $ ls -ld /opt/hadoop/bin/winutils.exe drwxr-xr-x 2 user user 4096 winutils.exe/ # a directory # after rm -rf /opt/hadoop/bin/winutils.exe cp cdarwin-winutils/hadoop-3.3.6/bin/winutils.exe /opt/hadoop/bin/ test -f /opt/hadoop/bin/winutils.exe && echo OK
Defensive patterns
Strategy: validation
Validate before calling
Path exe = Paths.get(System.getenv("HADOOP_HOME"), "bin", "winutils.exe");
if (Files.exists(exe) && !Files.isRegularFile(exe)) {
throw new IllegalStateException(exe + " is not a regular file — repair the bin directory");
} Try / catch
try { Shell.getQualifiedBin(exe); } catch (FileNotFoundException e) { /* path resolves to a directory/special file: replace with real binary, retry */ } Prevention
- After installing binaries, verify with test -f (regular file), not just existence
- Do not extract archives with tools that materialize folder-per-entry structures into bin/
- Repair broken symlinks in bin/ during the same provisioning step that installs the executable
When it happens
Trigger: A directory named winutils.exe (or the requested executable) sits inside bin/; a FIFO/device or broken symlink occupies the path; getQualifiedBin is called while the executable is being replaced mid-deploy.
Common situations: Extraction tools that create a folder per archive entry; someone 'organized' binaries into folders; interrupted copies leaving directories; symlink farms pointing at directory targets.
Related errors
- Error while running command to get file permissions : " + St
- %s does not exist or is not file.
- Dest filesystem '${fs.getUri().getScheme()}' doesn't support
- Hadoop bin directory does not exist: {}
- Hadoop bin directory is not a directory.: {}
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/a10fe8b6d0f4780f.
Report an issue: GitHub.