{"record":{"id":"643bf4fe218cb5dc","repo":"apache/hadoop","slug":"job-is-not-found","errorCode":null,"errorMessage":"job, {}, is not found","messagePattern":"job, (.+?), is not found","errorType":"http","errorClass":"NotFoundException","httpStatus":404,"severity":"warning","filePath":"hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/webapp/AMWebServices.java","lineNumber":150,"sourceCode":"     */\n public static Job getJobFromJobIdString(String jid, AppContext appCtx) throws NotFoundException {\n    JobId jobId;\n    Job job;\n    try {\n      jobId = MRApps.toJobID(jid);\n    } catch (YarnRuntimeException e) {\n      // TODO: after MAPREDUCE-2793 YarnRuntimeException is probably not expected here\n      // anymore but keeping it for now just in case other stuff starts failing.\n      // Also, the webservice should ideally return BadRequest (HTTP:400) when\n      // the id is malformed instead of NotFound (HTTP:404). The webserver on\n      // top of which AMWebServices is built seems to automatically do that for\n      // unhandled exceptions\n      throw new NotFoundException(e.getMessage());\n    } catch (IllegalArgumentException e) {\n      throw new NotFoundException(e.getMessage());\n    }\n    if (jobId == null) {\n      throw new NotFoundException(\"job, \" + jid + \", is not found\");\n    }\n    job = appCtx.getJob(jobId);\n    if (job == null) {\n      throw new NotFoundException(\"job, \" + jid + \", is not found\");\n    }\n    return job;\n  }\n\n  /**\n   * convert a task id string to an actual task and handle all the error\n   * checking.\n   */\n  public static Task getTaskFromTaskIdString(String tid, Job job) throws NotFoundException {\n    TaskId taskID;\n    Task task;\n    try {\n      taskID = MRApps.toTaskID(tid);\n    } catch (YarnRuntimeException e) {","sourceCodeStart":132,"sourceCodeEnd":168,"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/AMWebServices.java#L132-L168","documentation":"AMWebServices.getJobFromJobIdString converts the REST 'jobid' parameter and, when the conversion yields a null JobId (rather than throwing IllegalArgumentException), responds with NotFoundException — HTTP 404 with body 'job, <jid>, is not found'. The AM REST API (served via the AM webapp / RM proxy) only understands its own job, and a null after conversion means the id could not be mapped to a live job id.","triggerScenarios":"GET /mapreduce/ws/v1/mapreduce/jobs/{jobid} with an empty or structurally odd jobid string that survives parsing but maps to no JobId; null jid passed programmatically through the webapp routing.","commonSituations":"Hand-built URLs with typos in the job id; monitoring scraping AM REST after the id format changed expectations; trailing junk in the path segment.","solutions":["Use the exact job identifier from the application (job_&lt;startTime&gt;_&lt;seq&gt;) as reported by the RM or job client","For finished jobs, query the Job History Server REST endpoint instead of the AM","Validate the jobid format client-side before issuing the GET"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// client-side guard before hitting AM REST\nstatic boolean isPlausibleJobId(String jid) {\n  return jid != null && jid.matches(\"job_\\\\d+_\\\\d+\");\n}\nif (!isPlausibleJobId(jobid)) throw new IllegalArgumentException(\"bad jobid: \" + jobid);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always take the jobid verbatim from the job client / RM rather than assembling it by hand","Treat HTTP 404 from AM REST as 'unknown here' and fall back to JHS REST for finished jobs"],"tags":["mapreduce","rest","am-web-services","http-404","job-id"],"backgroundTag":"http-404-not-found","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}