{"record":{"id":"90d701de72d6cc5f","repo":"apache/hadoop","slug":"unknown-task","errorCode":null,"errorMessage":"Unknown Task {}","messagePattern":"Unknown Task (.+?)","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":223,"sourceCode":"      Job job = appContext.getJob(jobID);\n      if (job == null && exceptionThrow) {\n        throw new IOException(\"Unknown Job \" + jobID);\n      }\n      UserGroupInformation ugi = UserGroupInformation.getCurrentUser();\n      if (job != null && !job.checkAccess(ugi, accessType)) {\n        throw new AccessControlException(\"User \" + ugi.getShortUserName()\n            + \" cannot perform operation \" + accessType.name() + \" on \"\n            + jobID);\n      }\n      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();","sourceCodeStart":205,"sourceCodeEnd":241,"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#L205-L241","documentation":"verifyAndGetTask throws this IOException when the parent job resolves but job.getTask(taskID) returns null — the TaskId is syntactically valid but no such task exists in this job. TaskIds embed their own job id and type/sequence, so cross-job or out-of-range ids land here after verifyAndGetJob already passed.","triggerScenarios":"Client builds a TaskId with a wrong task number or wrong embedded JobId; querying a task index beyond mapreduce.job.maps/reduces; task id cached from a prior run of the same job.","commonSituations":"Polling loops that increment task indices instead of using job.getTasks(); ids copied from logs of an earlier attempt; ater AM restart with task renumbering.","solutions":["Iterate job.getTasks().keySet() (or use job.getTask(id) on the handle from the same job) instead of constructing TaskIds by hand","Refresh the Job handle after AM restart so embedded job attempt state matches","Log the requested TaskId next to the AM's live task list when debugging"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// only ask for tasks that actually exist on the current handle\nJob job = cluster.getJob(JobID.forName(jobIdString));\nfor (TaskReport report : job.getTaskReports(type)) { // enumerates real tasks\n  process(report.getTaskId());\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never construct TaskIds arithmetically — enumerate them from TaskReports","Bound task indices by the configured map/reduce counts if you must build ids","Refresh the Job handle after AM restarts so embedded ids stay valid"],"tags":["mapreduce","am-client","task-id","rpc"],"backgroundTag":"unknown-task-id","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}