{"record":{"id":"97a16a6cd4935c48","repo":"apache/hadoop","slug":"unknown-taskattempt","errorCode":null,"errorMessage":"Unknown TaskAttempt {}","messagePattern":"Unknown TaskAttempt (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/client/MRClientService.java","lineNumber":233,"sourceCode":"      return job;\n    }\n \n    private Task verifyAndGetTask(TaskId taskID, \n        JobACL accessType) throws IOException {\n      Task task =\n          verifyAndGetJob(taskID.getJobId(), accessType, true).getTask(taskID);\n      if (task == null) {\n        throw new IOException(\"Unknown Task \" + taskID);\n      }\n      return task;\n    }\n\n    private TaskAttempt verifyAndGetAttempt(TaskAttemptId attemptID, \n        JobACL accessType) throws IOException {\n      TaskAttempt attempt = verifyAndGetTask(attemptID.getTaskId(), \n          accessType).getAttempt(attemptID);\n      if (attempt == null) {\n        throw new IOException(\"Unknown TaskAttempt \" + attemptID);\n      }\n      return attempt;\n    }\n\n    @Override\n    public GetCountersResponse getCounters(GetCountersRequest request) \n      throws IOException {\n      JobId jobId = request.getJobId();\n      Job job = verifyAndGetJob(jobId, JobACL.VIEW_JOB, true);\n      GetCountersResponse response =\n        recordFactory.newRecordInstance(GetCountersResponse.class);\n      response.setCounters(TypeConverter.toYarn(job.getAllCounters()));\n      return response;\n    }\n    \n    @Override\n    public GetJobReportResponse getJobReport(GetJobReportRequest request) \n      throws IOException {","sourceCodeStart":215,"sourceCodeEnd":251,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/client/MRClientService.java#L215-L251","documentation":"verifyAndGetAttempt throws this IOException when the parent task resolves but task.getAttempt(attemptID) returns null — the attempt number does not exist for that task (attempts are numbered 0..n-1 per task, bounded by mapreduce.map.maxattempts / mapreduce.reduce.maxattempts).","triggerScenarios":"Client requests attemptId with attempt number >= attempts actually launched so far (race: asking about attempt 1 while only attempt 0 exists); attempt id string concatenated with a stale attempt counter; querying after the attempt was finalized.","commonSituations":"Progress dashboards computing attempt ids arithmetically instead of reading TaskReport.getCurrentAttemptAttemptIds / attempt lists; races between speculative-execution attempt launch and client queries.","solutions":["Enumerate real attempts via task.getAttempts().keySet() rather than constructing TaskAttemptId with a guessed number","Re-query the task report to learn which attempts exist before fetching attempt-level counters/diagnostics","Treat 'Unknown TaskAttempt' as a transient miss during task churn and retry once after a report refresh"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// before attempt-level queries, learn which attempts exist\nTaskReport report = ...; // from job.getTaskReports(type)\nfor (TaskAttemptID attemptId : report.getRunningTaskAttemptIds().isEmpty()\n        ? completedAttemptIdsFromTaskReport(report)\n        : report.getRunningTaskAttemptIds()) {\n  queryAttempt(attemptId);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use TaskReport.getRunningTaskAttemptIds() / task.getAttempts() instead of guessing attempt numbers","Treat attempt queries as eventually-consistent during speculative execution and re-check the report on miss"],"tags":["mapreduce","am-client","task-attempt","rpc"],"backgroundTag":"unknown-task-attempt-id","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}