{"record":{"id":"26a127357d74ca1a","repo":"apache/hadoop","slug":"unrecognized-priority","errorCode":null,"errorMessage":"Unrecognized priority: {}","messagePattern":"Unrecognized priority: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/TypeConverter.java","lineNumber":103,"sourceCode":"  }\n\n  public static int toYarnApplicationPriority(String priority) {\n    JobPriority jobPriority = JobPriority.valueOf(priority);\n    switch (jobPriority) {\n    case VERY_HIGH :\n      return 5;\n    case HIGH :\n      return 4;\n    case NORMAL :\n      return 3;\n    case LOW :\n      return 2;\n    case VERY_LOW :\n      return 1;\n    case DEFAULT :\n      return 0;\n    }\n    throw new IllegalArgumentException(\"Unrecognized priority: \" + priority);\n  }\n\n  private static String fromClusterTimeStamp(long clusterTimeStamp) {\n    return Long.toString(clusterTimeStamp);\n  }\n\n  private static long toClusterTimeStamp(String identifier) {\n    return Long.parseLong(identifier);\n  }\n\n  public static org.apache.hadoop.mapreduce.TaskType fromYarn(\n      TaskType taskType) {\n    switch (taskType) {\n    case MAP:\n      return org.apache.hadoop.mapreduce.TaskType.MAP;\n    case REDUCE:\n      return org.apache.hadoop.mapreduce.TaskType.REDUCE;\n    default:","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/TypeConverter.java#L85-L121","documentation":"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.","triggerScenarios":"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'.","commonSituations":"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.","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"],"exampleFix":"// before\nclient.setJobPriority(jobId, jobStatus.getJobPriority().name()); // may be UNDEFINED_PRIORITY -> throws\n\n// after\nString p = jobStatus.getJobPriority().name();\nif (\"UNDEFINED_PRIORITY\".equals(p)) { p = \"DEFAULT\"; }\nclient.setJobPriority(jobId, p);","handlingStrategy":"type-guard","validationCode":"private static final Set<String> CONVERTIBLE = new HashSet<>(Arrays.asList(\n    \"VERY_HIGH\", \"HIGH\", \"NORMAL\", \"LOW\", \"VERY_LOW\", \"DEFAULT\"));\nif (!CONVERTIBLE.contains(priorityStr)) {\n  priorityStr = \"DEFAULT\"; // normalize UNDEFINED_PRIORITY / unknown values\n}","typeGuard":"static boolean isConvertiblePriority(String p) {\n  try {\n    return EnumSet.of(JobPriority.VERY_HIGH, JobPriority.HIGH,\n        JobPriority.NORMAL, JobPriority.LOW, JobPriority.VERY_LOW,\n        JobPriority.DEFAULT).contains(JobPriority.valueOf(p));\n  } catch (IllegalArgumentException e) {\n    return false;\n  }\n}","tryCatchPattern":"try {\n  client.setJobPriority(jobId, priorityStr);\n} catch (IllegalArgumentException e) {\n  LOG.warn(\"Priority '{}' not convertible; using DEFAULT\", priorityStr);\n  client.setJobPriority(jobId, \"DEFAULT\");\n}","preventionTips":["Never echo UNDEFINED_PRIORITY back into the string priority API — normalize first","Keep client-core and client-common jars at one Hadoop version"],"tags":["hadoop","mapreduce","job-priority","enum-conversion","version-mismatch"],"backgroundTag":"unrecognized-enum-value","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}