apache/hadoop · critical · YarnRuntimeException
"Not creating intermediate history logDir: [" + doneDirPath
Error message
"Not creating intermediate history logDir: [" + doneDirPath + "] based on conf: mapreduce.am.create-intermediate-jh-base-dir. Either set to true or pre-create this directory with appropriate permissions"
What it means
At MR ApplicationMaster init, JobHistoryEventHandler checks the job-history intermediate done directory (mapreduce.jobhistory.intermediate-done-dir) on its filesystem. If the directory does not exist and mapreduce.am.create-intermediate-jh-base-dir is false (the default), the AM refuses to run and throws YarnRuntimeException('Not creating intermediate history logDir: ... Either set to true or pre-create this directory...'), failing the job before any task starts. The design expects the JobHistoryServer or deployment to have created that base directory.
Source
Thrown at hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/jobhistory/JobHistoryEventHandler.java:226
+ MRJobConfig.MR_AM_CREATE_JH_INTERMEDIATE_BASE_DIR);
mkdir(
doneDirFS,
doneDirPath,
new FsPermission(
JobHistoryUtils.HISTORY_INTERMEDIATE_DONE_DIR_PERMISSIONS
.toShort()));
// TODO Temporary toShort till new FsPermission(FsPermissions)
// respects
// sticky
} else {
String message = "Not creating intermediate history logDir: ["
+ doneDirPath
+ "] based on conf: "
+ MRJobConfig.MR_AM_CREATE_JH_INTERMEDIATE_BASE_DIR
+ ". Either set to true or pre-create this directory with" +
" appropriate permissions";
LOG.error(message);
throw new YarnRuntimeException(message);
}
}
} catch (IOException e) {
LOG.error("Failed checking for the existence of history intermediate " +
"done directory: [" + doneDirPath + "]");
throw new YarnRuntimeException(e);
}
//Check/create user directory under intermediate done dir.
try {
doneDirPrefixPath =
FileContext.getFileContext(conf).makeQualified(new Path(userDoneDirStr));
mkdir(doneDirFS, doneDirPrefixPath, JobHistoryUtils.
getConfiguredHistoryIntermediateUserDoneDirPermissions(conf));
} catch (IOException e) {
LOG.error("Error creating user intermediate history done directory: [ "
+ doneDirPrefixPath + "]", e);
throw new YarnRuntimeException(e);View on GitHub (pinned to 2add963021)
Solutions
- Pre-create the directory with history-appropriate permissions as part of deployment: hdfs dfs -mkdir -p <intermediate-done-dir> ; hdfs dfs -chmod 1771/1777 <intermediate-done-dir> (match your cluster's policy)
- Or set mapreduce.am.create-intermediate-jh-base-dir=true so the AM creates the base dir itself (fine for single-user/test clusters; shared clusters should pre-create it)
- Verify the exact configured value: mapreduce.jobhistory.intermediate-done-dir and the staging dir (yarn.app.mapreduce.am.staging-dir) resolve where you expect
- Confirm the JobHistoryServer is deployed and created its directory tree; check the AM logs for the doneDirPath in the message
Example fix
# before: dir absent, AM refuses to start # after: pre-create with history-server-friendly perms, or let the AM create it hdfs dfs -mkdir -p /mr-history/done_intermediate hdfs dfs -chmod 1777 /mr-history/done_intermediate # or in mapred-site.xml <property><name>mapreduce.am.create-intermediate-jh-base-dir</name><value>true</value></property>
Defensive patterns
Strategy: validation
Validate before calling
// pre-flight in the job client before submit
Path doneDir = new Path(conf.get("mapreduce.jobhistory.intermediate-done-dir",
"/tmp/hadoop-yarn/staging/history/done_intermediate"));
FileSystem fs = doneDir.getFileSystem(conf);
if (!fs.exists(doneDir)
&& !conf.getBoolean("mapreduce.am.create-intermediate-jh-base-dir", false)) {
throw new IOException("Pre-create " + doneDir
+ " or set mapreduce.am.create-intermediate-jh-base-dir=true");
} Try / catch
Catch YarnRuntimeException at AM init in integration tests and assert the message contains 'Not creating intermediate history logDir' -- then fail fast with the two remediation options instead of a generic AM launch failure.
Prevention
- Bake 'hdfs dfs -mkdir -p <intermediate-done-dir>' plus permissions into cluster deployment
- For test clusters set mapreduce.am.create-intermediate-jh-base-dir=true
- Whenever you change mapreduce.jobhistory.intermediate-done-dir, migrate the HDFS layout in the same change
When it happens
Trigger: Fresh cluster where the intermediate done dir (default under the staging root, e.g. <staging>/history/done_intermediate on HDFS) was never created; custom mapreduce.jobhistory.intermediate-done-dir pointing to a missing path; permissions let the AM see the dir is absent but policy forbids it to mkdir (flag false); history server not yet deployed when the first job is submitted.
Common situations: New installations or test clusters without a running JobHistoryServer; secure clusters where the pre-created dir has wrong ownership; config drift where staging/intermediate-done-dir moved but the HDFS layout was not migrated.
Related errors
- Missing Log Directory for History
- Not yet implemented.
- ShuffleProvider Service: {} was NOT found in the list of aux
- unable to load configuration for job: {}
- Error in instantiating YarnClient
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/f17436615afef83d.
Report an issue: GitHub.