apache/hadoop · error · FileNotFoundException
Hadoop bin directory does not exist: {}
Error message
Hadoop bin directory does not exist: {} What it means
Shell.getQualifiedBinInner() resolves <hadoopHome>/bin/<executable> for tools like winutils.exe. After the home directory passes validation, it checks that the bin subdirectory exists; if ${HADOOP_HOME}/bin is absent it throws FileNotFoundException with the OS-prefixed message. The Hadoop install is incomplete: home is fine, but the directory holding the scripts/binaries is missing.
Source
Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/Shell.java:661
throws FileNotFoundException {
// construct hadoop bin path to the specified executable
return getQualifiedBinInner(getHadoopHomeDir(), executable);
}
/**
* Inner logic of {@link #getQualifiedBin(String)}, accessible
* for tests.
* @param hadoopHomeDir home directory (assumed to be valid)
* @param executable executable
* @return path to the binary
* @throws FileNotFoundException if the executable was not found/valid
*/
static File getQualifiedBinInner(File hadoopHomeDir, String executable)
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();View on GitHub (pinned to 2add963021)
Solutions
- Verify the expected location: ls "$HADOOP_HOME/bin" — it must be a readable directory
- If missing, re-extract the full distribution or copy a version-matched bin/ directory into HADOOP_HOME
- Check whether bin/ actually exists one level up/down and repoint HADOOP_HOME to the directory that directly contains bin/
- On Windows, replace the ad-hoc folder with a proper winutils distribution layout (%HADOOP_HOME%\bin\winutils.exe)
Example fix
# before HADOOP_HOME=/opt/hadoop-min # contains jars only, no bin/ # after cp -r /opt/hadoop-3.3.6-full/bin /opt/hadoop-min/ ls /opt/hadoop-min/bin # bin/ now present
Defensive patterns
Strategy: validation
Validate before calling
File home = new File(System.getenv("HADOOP_HOME"));
File bin = new File(home, "bin");
if (!bin.isDirectory()) {
throw new IllegalStateException("Missing " + bin + " — incomplete Hadoop installation");
} Try / catch
try { Shell.getQualifiedBin("winutils.exe"); } catch (FileNotFoundException e) { /* provision bin/ then retry once */ } Prevention
- Never trim bin/ out of HADOOP_HOME when slimming images — Shell needs it for tool lookup
- Verify bin/ exists in the same startup check that validates HADOOP_HOME
- For Windows, install a full winutils distribution so %HADOOP_HOME%\bin is populated before the app starts
When it happens
Trigger: Calling Shell.getQualifiedBin() / getWinutilsPath() (directly or via Windows LocalFileSystem operations such as creating temp dirs or setting file permissions) when ${HADOOP_HOME}/bin does not exist; trimmed-down distributions that shipped only jars.
Common situations: Slim Docker images that copy hadoop jars but delete bin/ to save space; hand-assembled HADOOP_HOME folders containing only etc/ and share/; Windows setups where a winutils zip was extracted into the wrong level so bin/ landed elsewhere.
Related errors
- Hadoop bin directory is not a directory.: {}
- Error while running command to get file permissions : " + St
- Hadoop home directory {} does not exist
- Hadoop home directory {} is not a directory.
- Could not locate Hadoop executable: {}
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/ce9371fe9b73de7d.
Report an issue: GitHub.