apache/hadoop · error · NotFoundException

Error getting info on task attempt id {}

Error message

Error getting info on task attempt id {}

What it means

The attempt id parsed into a TaskAttemptId, but task.getAttempt(attemptId) returned null: the resolved task does not contain that attempt. The AM REST API returns HTTP 404 with 'Error getting info on task attempt id <attId>'.

Source

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

      // TODO: after MAPREDUCE-2793 YarnRuntimeException is probably not expected here
      // anymore but keeping it for now just in case other stuff starts failing.
      // Also, the webservice should ideally return BadRequest (HTTP:400) when
      // the id is malformed instead of NotFound (HTTP:404). The webserver on
      // top of which AMWebServices is built seems to automatically do that for
      // unhandled exceptions
      throw new NotFoundException(e.getMessage());
    } catch (NumberFormatException ne) {
      throw new NotFoundException(ne.getMessage());
    } catch (IllegalArgumentException e) {
      throw new NotFoundException(e.getMessage());
    }
    if (attemptId == null) {
      throw new NotFoundException("task attempt id " + attId
          + " not found or invalid");
    }
    ta = task.getAttempt(attemptId);
    if (ta == null) {
      throw new NotFoundException("Error getting info on task attempt id "
          + attId);
    }
    return ta;
  }


  /**
   * check for job access.
   *
   * @param job
   *          the job that is being accessed
   */
  void checkAccess(Job job, HttpServletRequest request) {
    if (!hasAccess(job, request)) {
      throw new WebApplicationException(Status.UNAUTHORIZED);
    }
  }

View on GitHub (pinned to 2add963021)

Solutions

  1. List attempts with GET .../tasks/{taskid}/attempts and use an id from that response
  2. Confirm the attempt id without its last '_<n>' segment equals the {taskid} in the URL
  3. For finished jobs use the Job History Server REST API instead of the AM

Example fix

// before: attempt of task m_000006 sent under task m_000005
GET .../tasks/task_1_0001_m_000005/attempts/attempt_1_0001_m_000006_0
// 404 { "Error getting info on task attempt id ..." }

// after: attempt belongs to the addressed task
GET .../tasks/task_1_0001_m_000005/attempts/attempt_1_0001_m_000005_0
Defensive patterns

Strategy: validation

Validate before calling

// The attempt id must be an extension of the task id it is queried under
String taskPrefix = tid; // e.g. task_1_0001_m_000005
if (!attId.startsWith(taskPrefix + "_")) {
  // attempt belongs to a different task; fix the URL or fetch the attempt list
}

Type guard

static boolean attemptBelongsToTask(String attId, String tid) {
  return attId != null && tid != null && attId.startsWith(tid + "_");
}

Try / catch

try {
  return getAttempt(jid, tid, attId);
} catch (javax.ws.rs.NotFoundException e) {
  // valid id but not an attempt of this task: list attempts and pick the latest
  attempts = listAttempts(jid, tid);
}

Prevention

When it happens

Trigger: GET .../tasks/{taskid}/attempts/{attemptid} (also /counters and PUT /state) where the attempt id's task portion differs from {taskid} - e.g. attempt_..._m_000005_0 sent under tasks/task_..._m_000006 - or the attempt number does not exist (asking for _1 when only _0 ran).

Common situations: Ids of retries or speculative attempts after a task re-runs; off-by-one in generated attempt numbers; copy-paste across tasks; querying after task restart moved the live attempt to a higher number.

Related errors


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