{"record":{"id":"3b892e0b65284cb2","repo":"apache/hadoop","slug":"missing-task-type","errorCode":null,"errorMessage":"missing task-type.","messagePattern":"missing task-type\\.","errorType":"http","errorClass":"RuntimeException","httpStatus":null,"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":288,"sourceCode":"    return AttemptsPage.class;\n  }\n  \n  /**\n   * Render the attempts page\n   */\n  public void attempts() {\n    try {\n      requireJob();\n    }\n    catch (Exception e) {\n      renderText(e.getMessage());\n      return;\n    }\n    if (app.getJob() != null) {\n      try {\n        String taskType = $(TASK_TYPE);\n        if (taskType.isEmpty()) {\n          throw new RuntimeException(\"missing task-type.\");\n        }\n        String attemptState = $(ATTEMPT_STATE);\n        if (attemptState.isEmpty()) {\n          throw new RuntimeException(\"missing attempt-state.\");\n        }\n        setTitle(join(attemptState, \" \",\n            MRApps.taskType(taskType).toString(), \" attempts in \", $(JOB_ID)));\n\n        render(attemptsPage());\n      } catch (Exception e) {\n        LOG.error(\"Failed to render attempts page with task type : \"\n            + $(TASK_TYPE) + \" for job id : \" + $(JOB_ID), e);\n        badRequest(e.getMessage());\n      }\n    }\n  }\n\n  /**","sourceCodeStart":270,"sourceCodeEnd":306,"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#L270-L306","documentation":"The ApplicationMaster web UI attempts page (AppController.attempts) requires both 'task.type' and 'attempt.state' query parameters. A missing or empty task.type throws RuntimeException(\"missing task-type.\"), which the surrounding catch turns into a 400 response via badRequest(); the page does not render.","triggerScenarios":"Opening http://<am-host>:8099/attempts with a valid job.id but without task.type, e.g. /attempts?job.id=job_1401318629735_0001&attempt.state=running.","commonSituations":"Hand-typed or bookmarked URLs whose query string got truncated; scraping scripts that assemble the URL partially; external links that only carry part of the parameters.","solutions":["Add task.type=m or task.type=r to the URL","Navigate from the job's tasks page - its links carry both parameters","Include attempt.state at the same time to avoid the next check failing ('missing attempt-state.')"],"exampleFix":"// before\nhttp://am-host:8099/attempts?job.id=job_1401318629735_0001&attempt.state=running\n// 400 missing task-type.\n\n// after\nhttp://am-host:8099/attempts?job.id=job_1401318629735_0001&task.type=m&attempt.state=running","handlingStrategy":"validation","validationCode":"String url = String.format(\n    \"http://%s:8099/attempts?job.id=%s&task.type=%s&attempt.state=%s\",\n    amHost, URLEncoder.encode(jobId, UTF_8),\n    taskType /* 'm' or 'r' */, attemptState /* e.g. 'running' */);\nif (taskType == null || taskType.isEmpty()) throw new IllegalArgumentException(\"task.type required\");","typeGuard":"static boolean isCompleteAttemptsUrl(String taskType, String attemptState) {\n  return taskType != null && !taskType.isEmpty()\n      && attemptState != null && !attemptState.isEmpty();\n}","tryCatchPattern":null,"preventionTips":["Build attempts-page URLs from one helper that requires all three parameters","Navigate via the tasks page links instead of hand-typing URLs","Keep bookmarks with the full query string, not the bare page path"],"tags":["mapreduce","web-ui","http-400","applicationmaster","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"}