apache/hadoop · error · IllegalArgumentException

Job Priority cannot be null.

Error message

Job Priority cannot be null.

What it means

org.apache.hadoop.mapreduce.JobStatus is the wire/DAO object describing a job. Its primary constructor requires a non-null JobPriority (jp) — null means corrupted or missing data, since every real JobTracker/RM assigns at least NORMAL — so it throws IllegalArgumentException('Job Priority cannot be null.') at JobStatus.java:211 rather than silently building an inconsistent status.

Source

Thrown at hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/JobStatus.java:211

  * @param isUber Whether job running in uber mode
  * @param historyFile history file
  */
  public JobStatus(JobID jobid, float setupProgress, float mapProgress,
                   float reduceProgress, float cleanupProgress,
                   State runState, JobPriority jp,
                   String user, String jobName, String queue,
                   String jobFile, String trackingUrl, boolean isUber,
                   String historyFile) {
    this.jobid = jobid;
    this.setupProgress = setupProgress;
    this.mapProgress = mapProgress;
    this.reduceProgress = reduceProgress;
    this.cleanupProgress = cleanupProgress;
    this.runState = runState;
    this.user = user;
    this.queue = queue;
    if (jp == null) {
      throw new IllegalArgumentException("Job Priority cannot be null.");
    }
    priority = jp;
    this.jobName = jobName;
    this.jobFile = jobFile;
    this.trackingUrl = trackingUrl;
    this.isUber = isUber;
    this.historyFile = historyFile;
  }


  /**
   * Sets the map progress of this job
   * @param p The value of map progress to set to
   */
  protected synchronized void setMapProgress(float p) { 
    this.mapProgress = (float) Math.min(1.0, Math.max(0.0, p)); 
  }

View on GitHub (pinned to 2add963021)

Solutions

  1. Pass an explicit default: JobPriority.NORMAL when priority is unknown
  2. In tests, use a builder or helper that always fills priority instead of hand-writing constructor args
  3. Align client and cluster Hadoop versions so RPC deserialization populates all fields
  4. Null-check upstream data and substitute NORMAL before constructing, logging the substitution

Example fix

// before
JobStatus st = new JobStatus(id, 0f, 0f, 0f, 0f, State.RUNNING,
    JobStatus.Syntax.OLD, "user", "job", "default", "file", "url", false, null, null);
// -> IllegalArgumentException: Job Priority cannot be null.

// after
JobPriority prio = (parsedPriority != null) ? parsedPriority : JobPriority.NORMAL;
JobStatus st = new JobStatus(id, 0f, 0f, 0f, 0f, State.RUNNING,
    JobStatus.Syntax.OLD, "user", "job", "default", "file", "url", false, prio, null);
Defensive patterns

Strategy: validation

Validate before calling

// normalize priority before constructing JobStatus
JobPriority effective = (priority != null) ? priority : JobPriority.NORMAL;
JobStatus st = new JobStatus(jobid, 0f, 0f, 0f, 0f, runState,
    syncInfo, user, jobName, queue, jobFile, trackingUrl, isUber, effective, historyFile);

Type guard

static JobPriority nonNullPriority(JobPriority p) {
  return (p != null) ? p : JobPriority.NORMAL;
}

Try / catch

try {
  return new JobStatus(..., jp, ...);
} catch (IllegalArgumentException e) {
  if ("Job Priority cannot be null.".equals(e.getMessage())) {
    return new JobStatus(..., JobPriority.NORMAL, ...); // or fix upstream data
  }
  throw e;
}

Prevention

When it happens

Trigger: Application code constructing JobStatus directly (mocks, test fixtures, custom monitoring layers) and passing null for priority; deserialization/RPC paths from a peer that omitted the priority field; old Hadoop 1.x-era data being read into the 2.x/3.x class where the field ordering or presence differs.

Common situations: Unit tests stubbing JobStatus with a compact constructor call; homegrown tooling that synthesizes JobStatus objects from parsed logs; version-mismatched client/server jars on the classpath causing partial deserialization.

Related errors


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