apache/hadoop · error · RuntimeException

missing task-type.

Error message

missing task-type.

What it means

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.

Source

Thrown at hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/webapp/AppController.java:288

    return AttemptsPage.class;
  }
  
  /**
   * Render the attempts page
   */
  public void attempts() {
    try {
      requireJob();
    }
    catch (Exception e) {
      renderText(e.getMessage());
      return;
    }
    if (app.getJob() != null) {
      try {
        String taskType = $(TASK_TYPE);
        if (taskType.isEmpty()) {
          throw new RuntimeException("missing task-type.");
        }
        String attemptState = $(ATTEMPT_STATE);
        if (attemptState.isEmpty()) {
          throw new RuntimeException("missing attempt-state.");
        }
        setTitle(join(attemptState, " ",
            MRApps.taskType(taskType).toString(), " attempts in ", $(JOB_ID)));

        render(attemptsPage());
      } catch (Exception e) {
        LOG.error("Failed to render attempts page with task type : "
            + $(TASK_TYPE) + " for job id : " + $(JOB_ID), e);
        badRequest(e.getMessage());
      }
    }
  }

  /**

View on GitHub (pinned to 2add963021)

Solutions

  1. Add task.type=m or task.type=r to the URL
  2. Navigate from the job's tasks page - its links carry both parameters
  3. Include attempt.state at the same time to avoid the next check failing ('missing attempt-state.')

Example fix

// before
http://am-host:8099/attempts?job.id=job_1401318629735_0001&attempt.state=running
// 400 missing task-type.

// after
http://am-host:8099/attempts?job.id=job_1401318629735_0001&task.type=m&attempt.state=running
Defensive patterns

Strategy: validation

Validate before calling

String url = String.format(
    "http://%s:8099/attempts?job.id=%s&task.type=%s&attempt.state=%s",
    amHost, URLEncoder.encode(jobId, UTF_8),
    taskType /* 'm' or 'r' */, attemptState /* e.g. 'running' */);
if (taskType == null || taskType.isEmpty()) throw new IllegalArgumentException("task.type required");

Type guard

static boolean isCompleteAttemptsUrl(String taskType, String attemptState) {
  return taskType != null && !taskType.isEmpty()
      && attemptState != null && !attemptState.isEmpty();
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/3b892e0b65284cb2. Report an issue: GitHub.