apache/hadoop · error · IllegalArgumentException
Unrecognized priority: {}
Error message
Unrecognized priority: {} What it means
TypeConverter.toYarnApplicationPriority(String) parses the string with JobPriority.valueOf and switches over VERY_HIGH..DEFAULT mapping them to 5..0; any parsed constant outside that set falls through to IllegalArgumentException. Note JobPriority also defines UNDEFINED_PRIORITY (used when converting YARN's integer priorities), so 'UNDEFINED_PRIORITY' parses fine but reaches the throw. The same class's fromYarn(int) returns UNDEFINED_PRIORITY for unmapped integers, creating a round-trip hazard.
Source
Thrown at hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/TypeConverter.java:103
}
public static int toYarnApplicationPriority(String priority) {
JobPriority jobPriority = JobPriority.valueOf(priority);
switch (jobPriority) {
case VERY_HIGH :
return 5;
case HIGH :
return 4;
case NORMAL :
return 3;
case LOW :
return 2;
case VERY_LOW :
return 1;
case DEFAULT :
return 0;
}
throw new IllegalArgumentException("Unrecognized priority: " + priority);
}
private static String fromClusterTimeStamp(long clusterTimeStamp) {
return Long.toString(clusterTimeStamp);
}
private static long toClusterTimeStamp(String identifier) {
return Long.parseLong(identifier);
}
public static org.apache.hadoop.mapreduce.TaskType fromYarn(
TaskType taskType) {
switch (taskType) {
case MAP:
return org.apache.hadoop.mapreduce.TaskType.MAP;
case REDUCE:
return org.apache.hadoop.mapreduce.TaskType.REDUCE;
default:View on GitHub (pinned to 2add963021)
Solutions
- Pass one of the six mapped names: VERY_HIGH, HIGH, NORMAL, LOW, VERY_LOW, DEFAULT
- Normalize UNDEFINED_PRIORITY to DEFAULT/NORMAL before calling the string priority API
- Align hadoop-mapreduce-client-core and client-common to the same version to avoid constant drift
Example fix
// before
client.setJobPriority(jobId, jobStatus.getJobPriority().name()); // may be UNDEFINED_PRIORITY -> throws
// after
String p = jobStatus.getJobPriority().name();
if ("UNDEFINED_PRIORITY".equals(p)) { p = "DEFAULT"; }
client.setJobPriority(jobId, p); Defensive patterns
Strategy: type-guard
Validate before calling
private static final Set<String> CONVERTIBLE = new HashSet<>(Arrays.asList(
"VERY_HIGH", "HIGH", "NORMAL", "LOW", "VERY_LOW", "DEFAULT"));
if (!CONVERTIBLE.contains(priorityStr)) {
priorityStr = "DEFAULT"; // normalize UNDEFINED_PRIORITY / unknown values
} Type guard
static boolean isConvertiblePriority(String p) {
try {
return EnumSet.of(JobPriority.VERY_HIGH, JobPriority.HIGH,
JobPriority.NORMAL, JobPriority.LOW, JobPriority.VERY_LOW,
JobPriority.DEFAULT).contains(JobPriority.valueOf(p));
} catch (IllegalArgumentException e) {
return false;
}
} Try / catch
try {
client.setJobPriority(jobId, priorityStr);
} catch (IllegalArgumentException e) {
LOG.warn("Priority '{}' not convertible; using DEFAULT", priorityStr);
client.setJobPriority(jobId, "DEFAULT");
} Prevention
- Never echo UNDEFINED_PRIORITY back into the string priority API — normalize first
- Keep client-core and client-common jars at one Hadoop version
When it happens
Trigger: Passing 'UNDEFINED_PRIORITY' (obtained from TypeConverter.fromYarn of an out-of-range integer priority) back into setJobPriority/toYarnApplicationPriority; a new JobPriority constant from a newer hadoop-mapreduce-client-core on an older client-common; 'hadoop job -set-priority job UNDEFINED_PRIORITY'.
Common situations: Jobs whose priority came from YARN integer scheduling (converted to UNDEFINED_PRIORITY) later modified through the old string API; mixed-version Hadoop jars on one classpath; custom job-submission wrappers echoing JobStatus priority strings.
Related errors
- Unrecognized task type: {}
- Unrecognized State: {}
- Unrecognized Phase: {}
- Unrecognized status: {}
- Unrecognized job state: {}
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/26a127357d74ca1a.
Report an issue: GitHub.