{"record":{"id":"0a7a07e708d17cf7","repo":"apache/hadoop","slug":"unable-to-get-log-information-for-job-oldjobid","errorCode":null,"errorMessage":"Unable to get log information for job: {oldJobID}","messagePattern":"Unable to get log information for job: (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/ClientServiceDelegate.java","lineNumber":523,"sourceCode":"        taRequest.setTaskAttemptId(TypeConverter.toYarn(oldTaskAttemptID));\n        TaskAttemptReport taReport =\n            ((GetTaskAttemptReportResponse) invoke(\"getTaskAttemptReport\",\n                GetTaskAttemptReportRequest.class, taRequest))\n                .getTaskAttemptReport();\n        if (taReport.getContainerId() == null\n            || taReport.getNodeManagerHost() == null) {\n          throw new IOException(\"Unable to get log information for task: \"\n              + oldTaskAttemptID);\n        }\n        return new LogParams(\n            taReport.getContainerId().toString(),\n            taReport.getContainerId().getApplicationAttemptId()\n                .getApplicationId().toString(),\n            NodeId.newInstance(taReport.getNodeManagerHost(),\n                taReport.getNodeManagerPort()).toString(), report.getUser());\n      } else {\n        if (report.getAMInfos() == null || report.getAMInfos().size() == 0) {\n          throw new IOException(\"Unable to get log information for job: \"\n              + oldJobID);\n        }\n        AMInfo amInfo = report.getAMInfos().get(report.getAMInfos().size() - 1);\n        return new LogParams(\n            amInfo.getContainerId().toString(),\n            amInfo.getAppAttemptId().getApplicationId().toString(),\n            NodeId.newInstance(amInfo.getNodeManagerHost(),\n                amInfo.getNodeManagerPort()).toString(), report.getUser());\n      }\n    } else {\n      throw new IOException(\"Cannot get log path for a in-progress job\");\n    }\n  }\n\n  public void close() throws IOException {\n    if (rm != null) {\n      rm.close();\n    }","sourceCodeStart":505,"sourceCodeEnd":541,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/ClientServiceDelegate.java#L505-L541","documentation":"Thrown by ClientServiceDelegate.getLogFilePath when the job is finished, no task attempt id was supplied, and the job report's AMInfos list is null or empty. AMInfos records the ApplicationMaster's own container locations; without them the client cannot locate the job's logs and raises IOException. It typically means the job ended before any AM container registered — the classic signature of a job that failed at launch.","triggerScenarios":"Calling getLogFileParams for a job that FAILED/KILLED before the AM started or before its first heartbeat registered AM info (e.g. AM container launch failure, unrecoverable speculator state, job killed in NEW/NEW_SAVING/SUBMITTED).","commonSituations":"AM container failures: bad job jar, missing main class, insufficient container resources, node loss during launch; Job killed immediately after submission (yarn application -kill or queue ACL rejection after accept); RM or AM restart scenarios where history/AM info was never populated","solutions":["Inspect the failure cause: yarn application -status / RM logs for the app's diagnostics — the AM never started, so logs of the job itself do not exist","If you need client-side logs, use `yarn logs -applicationId` which reads whatever the NM aggregated (often just launch errors)","Fix the underlying launch failure (job jar path, AM resources, main class) before requesting log paths","Do not call getLogFileParams for jobs whose report shows zero AM attempts — guard on report.getAMInfos()"],"exampleFix":"// before\nLogParams lp = clusterClient.getLogFileParams(jobId, null); // throws: AMInfos empty\n\n// after\nJobReport rpt = ...;\nif (rpt.getAMInfos() == null || rpt.getAMInfos().isEmpty()) {\n  throw new IllegalStateException(\"job never started an AM - see RM diagnostics\");\n}\nLogParams lp = clusterClient.getLogFileParams(jobId, null);","handlingStrategy":"try-catch","validationCode":"JobReport rpt = getReport(jobId);\nboolean amEverRan = rpt.getAMInfos() != null && !rpt.getAMInfos().isEmpty();\nif (!amEverRan) return amLaunchDiagnostics(appId); // no logs exist, show why","typeGuard":null,"tryCatchPattern":"try {\n  LogParams lp = cluster.getLogFileParams(jobId);\n} catch (IOException e) {\n  if (e.getMessage().contains(\"Unable to get log information for job\"))\n    return yarnApplicationDiagnostics(appId); // AM never started\n  throw e;\n}","preventionTips":["Guard on AMInfos emptiness before calling getLogFileParams","For instantly-failed jobs go straight to `yarn application -status` diagnostics","Fix AM launch prerequisites (jar, main class, am-resource limits) — no log params will ever exist otherwise"],"tags":["hadoop","mapreduce","yarn","logs","am-failure","null-field"],"backgroundTag":"aggregated-logs-unavailable","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}