{"record":{"id":"98f5aac9fe8d4a22","repo":"apache/hadoop","slug":"not-found-98f5aa","errorCode":null,"errorMessage":"Not Found: {}","messagePattern":"Not Found: (.+?)","errorType":"http","errorClass":"RuntimeException","httpStatus":404,"severity":"error","filePath":"hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/webapp/AppController.java","lineNumber":419,"sourceCode":"      return false;\n    }\n    return true;\n  }\n\n  /**\n   * Ensure that a JOB_ID was passed into the page.\n   */\n  public void requireJob() {\n    if ($(JOB_ID).isEmpty()) {\n      badRequest(\"missing job ID\");\n      throw new RuntimeException(\"Bad Request: Missing job ID\");\n    }\n\n    JobId jobID = MRApps.toJobID($(JOB_ID));\n    app.setJob(app.context.getJob(jobID));\n    if (app.getJob() == null) {\n      notFound($(JOB_ID));\n      throw new RuntimeException(\"Not Found: \" + $(JOB_ID));\n    }\n\n    /* check for acl access */\n    Job job = app.context.getJob(jobID);\n    if (!checkAccess(job)) {\n      accessDenied(\"User \" + request().getRemoteUser() + \" does not have \" +\n          \" permission to view job \" + $(JOB_ID));\n      throw new RuntimeException(\"Access denied: User \" +\n          request().getRemoteUser() + \" does not have permission to view job \" +\n          $(JOB_ID));\n    }\n  }\n\n  /**\n   * Ensure that a TASK_ID was passed into the page.\n   */\n  public void requireTask() {\n    if ($(TASK_ID).isEmpty()) {","sourceCodeStart":401,"sourceCodeEnd":437,"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/webapp/AppController.java#L401-L437","documentation":"requireJob parsed the job id (a malformed id fails earlier inside MRApps.toJobID) but app.context.getJob(jobID) returned null: this ApplicationMaster does not know the job. The UI answers 404 with 'Not Found: <jobid>'.","triggerScenarios":"Querying the AM UI with a job id served by a different ApplicationMaster; the job already finished and its AM exited; wrong port reached (another app's AM); id well-formed but never existed.","commonSituations":"Old link followed after job completion; ResourceManager restart left the tracking URL stale; several MR jobs running and ids confused between them.","solutions":["Verify the job still runs via the ResourceManager UI/API and open its current tracking URL","For completed jobs use the Job History Server UI (port 19888)","Check the full id including the sequence number after the timestamp"],"exampleFix":"// before: stale AM link for a finished job\nhttp://am-host:8099/job?job.id=job_1401318629735_0001\n// 404 Not Found: job_1401318629735_0001\n\n// after: history server for finished jobs\nhttp://jhs-host:19888/jobhistory/job/job_1401318629735_0001","handlingStrategy":"validation","validationCode":"// Resolve the live tracking URL from the RM instead of hard-coding an AM address\nApplicationReport r = yarnApps.get(appId);\nYarnApplicationState s = r.getYarnApplicationState();\nif (s == YarnApplicationState.FINISHED || s == YarnApplicationState.FAILED\n    || s == YarnApplicationState.KILLED) {\n  // AM is gone: use the Job History Server UI instead\n} else {\n  String ui = r.getTrackingUrl(); // live AM UI with job.id links\n}","typeGuard":null,"tryCatchPattern":"try {\n  open(amUrl + \"/job?job.id=\" + jobId);\n} catch (PageNotFoundException e404) {\n  // AM no longer serves this job: fall back to history server\n  open(\"http://\" + jhsHost + \":19888/jobhistory/job/\" + jobId);\n}","preventionTips":["Never persist AM URLs - resolve the tracking URL per request from the RM","Switch to the history server as soon as the application reaches a final state","Verify the sequence segment of the job id when multiple jobs share a timestamp"],"tags":["mapreduce","web-ui","http-404","applicationmaster","job-id"],"backgroundTag":"http-404-not-found","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}