{"record":{"id":"1ca7f5baa9cafa0a","repo":"apache/hadoop","slug":"unknown-job","errorCode":null,"errorMessage":"Unknown Job {}","messagePattern":"Unknown Job (.+?)","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":207,"sourceCode":"  public int getHttpPort() {\n    return webApp.port();\n  }\n\n  class MRClientProtocolHandler implements MRClientProtocol {\n\n    private RecordFactory recordFactory = \n      RecordFactoryProvider.getRecordFactory(null);\n\n    @Override\n    public InetSocketAddress getConnectAddress() {\n      return getBindAddress();\n    }\n    \n    private Job verifyAndGetJob(JobId jobID, JobACL accessType,\n        boolean exceptionThrow) throws IOException {\n      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;","sourceCodeStart":189,"sourceCodeEnd":225,"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#L189-L225","documentation":"MRClientService.verifyAndGetJob throws this IOException when a client of the AM's MRClientProtocol (getCounters, getTaskReports, killJob, ...) sends a JobId that appContext.getJob(jobID) does not know. A MapReduce AM hosts exactly one job for its application, so any other, stale, or malformed-but-parseable JobId is rejected before ACL checks run.","triggerScenarios":"Client uses a JobId from a previous AM attempt generation after the app was restarted; a tool polls the AM with a JobId taken from a different application; job state already transitioned past cleanup so the job was removed from appContext.","commonSituations":"Stale Cluster/Job handles in a long-running client after RM-triggered AM restart; job-status pollers mixing AM and JobHistoryServer endpoints; scripts that cache job IDs across resubmissions of the same workflow step.","solutions":["Re-fetch the Job handle from the running cluster (job = cluster.getJob(jobId)) and confirm the applicationId/attempt still matches before each AM RPC","Route status queries for finished or unknown jobs to the Job History Server (mapreduce.jobhistory.webapp.address) instead of the AM","If the error is immediate after submission, print the JobId actually used and compare against yarn application -list output for the app's tracking URL"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// client-side: confirm the app (and its AM) is alive and owns the job before AM RPCs\nApplicationReport rpt = yarnClient.getApplicationReport(appId);\nif (rpt.getYarnApplicationState().isFinalState()) {\n  // finished: use JobHistoryServer, not the AM\n}\nJob job = cluster.getJob(JobID.forName(jobIdString));\nif (job == null) { /* refresh or route to JHS instead of calling the AM */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Re-create Job/Cluster handles after AM restarts instead of caching them across retries","Query the JobHistoryServer for any job not in RUNNING state","Log the JobId you send alongside the AM's applicationId when integrating AM RPCs"],"tags":["mapreduce","am-client","job-id","rpc"],"backgroundTag":"unknown-job-id","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}