{"record":{"id":"95555729a55a5c53","repo":"apache/hadoop","slug":"missing-task-id","errorCode":null,"errorMessage":"missing task ID","messagePattern":"missing task ID","errorType":"http","errorClass":"RuntimeException","httpStatus":400,"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":439,"sourceCode":"\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()) {\n      badRequest(\"missing task ID\");\n      throw new RuntimeException(\"missing task ID\");\n    }\n\n    TaskId taskID = MRApps.toTaskID($(TASK_ID));\n    Job job = app.context.getJob(taskID.getJobId());\n    app.setJob(job);\n    if (app.getJob() == null) {\n      notFound(MRApps.toString(taskID.getJobId()));\n      throw new RuntimeException(\"Not Found: \" + $(JOB_ID));\n    } else {\n      app.setTask(app.getJob().getTask(taskID));\n      if (app.getTask() == null) {\n        notFound($(TASK_ID));\n        throw new RuntimeException(\"Not Found: \" + $(TASK_ID));\n      }\n    }\n    if (!checkAccess(job)) {\n      accessDenied(\"User \" + request().getRemoteUser() + \" does not have \" +\n          \" permission to view job \" + $(JOB_ID));","sourceCodeStart":421,"sourceCodeEnd":457,"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#L421-L457","documentation":"requireTask guards task-scoped pages of the AM web UI: it needs the 'task.id' query parameter holding a full task id (task_<ts>_<seq>_[m|r]_<n>). When the value is missing or empty the page answers 400 (badRequest) and this RuntimeException aborts rendering.","triggerScenarios":"Opening /task without ?task.id=task_..., or with an empty value; typically also missing job.id (that check runs first in some pages, task.id here).","commonSituations":"URL truncated when shared; scraping scripts that forget the parameter; links built from partial job data.","solutions":["Append the full task id: /task?job.id=job_...&task.id=task_1401318629735_0001_m_000003","Open the job's task list page first and follow the generated links","Check that templating did not swallow the query string"],"exampleFix":"// before\nhttp://am-host:8099/task?job.id=job_1401318629735_0001\n// 400 missing task ID\n\n// after\nhttp://am-host:8099/task?job.id=job_1401318629735_0001&task.id=task_1401318629735_0001_m_000003","handlingStrategy":"validation","validationCode":"if (taskId == null || taskId.isEmpty() || !taskId.startsWith(\"task_\")) {\n  throw new IllegalArgumentException(\n      \"task.id query parameter is required: ?task.id=task_<ts>_<seq>_[m|r]_<n>\");\n}\nString url = amUrl + \"/task?job.id=\" + enc(jobId) + \"&task.id=\" + enc(taskId);","typeGuard":"static boolean isCompleteTaskUrl(String jobId, String taskId) {\n  return jobId != null && !jobId.isEmpty()\n      && taskId != null && taskId.startsWith(\"task_\");\n}","tryCatchPattern":null,"preventionTips":["Require both job.id and task.id in the URL builder","Get task ids from the job's task list page links","Watch for templating engines that silently drop empty variables"],"tags":["mapreduce","web-ui","http-400","applicationmaster","task-id","query-parameter"],"backgroundTag":"missing-required-query-parameter","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}