apache/hadoop · error · IOException
Unable to get log information for task: {oldTaskAttemptID}
Error message
Unable to get log information for task: {oldTaskAttemptID} What it means
Thrown by ClientServiceDelegate.getLogFilePath when the job is in a terminal state (SUCCEEDED/FAILED/KILLED/ERROR) and a task attempt id was given, but the TaskAttemptReport obtained from the AM/history proxy has a null containerId or null nodeManagerHost. Without those fields the client cannot compute the NodeManager log address, so it raises IOException instead of returning bogus LogParams.
Source
Thrown at hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/ClientServiceDelegate.java:512
recordFactory.newRecordInstance(GetJobReportRequest.class);
request.setJobId(jobId);
JobReport report =
((GetJobReportResponse) invoke("getJobReport",
GetJobReportRequest.class, request)).getJobReport();
if (EnumSet.of(JobState.SUCCEEDED, JobState.FAILED, JobState.KILLED,
JobState.ERROR).contains(report.getJobState())) {
if (oldTaskAttemptID != null) {
GetTaskAttemptReportRequest taRequest =
recordFactory.newRecordInstance(GetTaskAttemptReportRequest.class);
taRequest.setTaskAttemptId(TypeConverter.toYarn(oldTaskAttemptID));
TaskAttemptReport taReport =
((GetTaskAttemptReportResponse) invoke("getTaskAttemptReport",
GetTaskAttemptReportRequest.class, taRequest))
.getTaskAttemptReport();
if (taReport.getContainerId() == null
|| taReport.getNodeManagerHost() == null) {
throw new IOException("Unable to get log information for task: "
+ oldTaskAttemptID);
}
return new LogParams(
taReport.getContainerId().toString(),
taReport.getContainerId().getApplicationAttemptId()
.getApplicationId().toString(),
NodeId.newInstance(taReport.getNodeManagerHost(),
taReport.getNodeManagerPort()).toString(), report.getUser());
} else {
if (report.getAMInfos() == null || report.getAMInfos().size() == 0) {
throw new IOException("Unable to get log information for job: "
+ oldJobID);
}
AMInfo amInfo = report.getAMInfos().get(report.getAMInfos().size() - 1);
return new LogParams(
amInfo.getContainerId().toString(),
amInfo.getAppAttemptId().getApplicationId().toString(),
NodeId.newInstance(amInfo.getNodeManagerHost(),View on GitHub (pinned to 2add963021)
Solutions
- Use `yarn logs -applicationId <appId>` (aggregated logs) instead of per-attempt LogParams for finished jobs
- Verify the attempt actually ran: check the attempt report via JHS REST .../tasks/{taskid}/attempts — attempts with no container cannot yield log paths
- Retry once JHS has fully loaded the job's history (finish + cache refresh)
Example fix
# before LogParams lp = cluster.getLogFileParams(oldTaskAttemptID); // IOException # after # use the YARN CLI aggregated-log path for finished apps yarn logs -applicationId application_1400000000000_0001 -logFiles syslog # or confirm the attempt has a container first via JHS REST attempts listing
Defensive patterns
Strategy: try-catch
Validate before calling
TaskAttemptReport ta = jhsRestGetAttempt(jid, tid); if (ta == null || ta.getContainerId() == null || ta.getNodeManagerHost() == null) return Optional.empty(); // no container -> no log params possible
Try / catch
try {
LogParams lp = cluster.getLogFileParams(attemptId);
} catch (IOException e) {
if (e.getMessage().startsWith("Unable to get log information for task"))
return fallbackToYarnLogs(appId); // `yarn logs -applicationId`
throw e;
} Prevention
- Prefer `yarn logs -applicationId <id>` for finished jobs — it does not depend on per-attempt NM fields
- Check the attempt's state via JHS REST before asking for log params; UNASSIGNED attempts have no container
- Treat missing containerId/NM-host as 'attempt never launched' rather than retrying
When it happens
Trigger: Calling getJobLogFileParams/Cluster.getLogFileParams (e.g. via JobClient) for a finished job with a specific oldTaskAttemptID whose attempt never launched a container (was speculatively scheduled then pre-empted, or UNASSIGNED), or whose report from the history server lacks NM location fields.
Common situations: Fetching log parameters for an attempt that failed before container assignment; History server data for the attempt is partial (JHS restarted mid-job, recovery incomplete); Passing an attempt id that belongs to a different run of the job
Related errors
- Unable to get log information for job: {oldJobID}
- User is not set in the application report
- Cannot get log path for a in-progress job
- Unrecognized task type: {}
- Unrecognized State: {}
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/ebd057e43a7a10ea.
Report an issue: GitHub.