{"record":{"id":"1ed231e443436120","repo":"apache/hadoop","slug":"unrecognized-state","errorCode":null,"errorMessage":"Unrecognized State: {}","messagePattern":"Unrecognized State: (.+?)","errorType":"exception","errorClass":"YarnRuntimeException","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":169,"sourceCode":"  public static TaskAttemptState toYarn(\n      org.apache.hadoop.mapred.TaskStatus.State state) {\n    switch (state) {\n    case COMMIT_PENDING:\n      return TaskAttemptState.COMMIT_PENDING;\n    case FAILED:\n    case FAILED_UNCLEAN:\n      return TaskAttemptState.FAILED;\n    case KILLED:\n    case KILLED_UNCLEAN:\n      return TaskAttemptState.KILLED;\n    case RUNNING:\n      return TaskAttemptState.RUNNING;\n    case SUCCEEDED:\n      return TaskAttemptState.SUCCEEDED;\n    case UNASSIGNED:\n      return TaskAttemptState.STARTING;\n    default:\n      throw new YarnRuntimeException(\"Unrecognized State: \" + state);\n    }\n  }\n\n  public static Phase toYarn(org.apache.hadoop.mapred.TaskStatus.Phase phase) {\n    switch (phase) {\n    case STARTING:\n      return Phase.STARTING;\n    case MAP:\n      return Phase.MAP;\n    case SHUFFLE:\n      return Phase.SHUFFLE;\n    case SORT:\n      return Phase.SORT;\n    case REDUCE:\n      return Phase.REDUCE;\n    case CLEANUP:\n      return Phase.CLEANUP;\n    default:","sourceCodeStart":151,"sourceCodeEnd":187,"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#L151-L187","documentation":"TypeConverter.toYarn(org.apache.hadoop.mapred.TaskStatus.State) maps the classic attempt-state enum onto YARN TaskAttemptState: COMMIT_PENDING, FAILED/FAILED_UNCLEAN, KILLED/KILLED_UNCLEAN, RUNNING, SUCCEEDED, UNASSIGNED(→STARTING). Any other constant hits the default and throws YarnRuntimeException. With the current classic enum all eight constants are covered, so the throw signals an unexpected/new constant (version drift) or a corrupted state value.","triggerScenarios":"Converting a TaskStatus whose State is not one of the eight handled constants — practically only possible with a newer mapred enum on the classpath or a hand-crafted TaskStatus in tests.","commonSituations":"Mixed-version Hadoop jars (newer hadoop-mapreduce-client-core with older client-common); unit tests constructing TaskStatus with custom states; forks that add attempt states.","solutions":["Make hadoop-mapreduce-client-core and client-common the same version","In tests, use only the real TaskStatus.State constants","Catch YarnRuntimeException and surface the raw state string in diagnostics"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"private static final Set<TaskStatus.State> CONVERTIBLE_STATES = EnumSet.of(\n    TaskStatus.State.COMMIT_PENDING, TaskStatus.State.FAILED,\n    TaskStatus.State.FAILED_UNCLEAN, TaskStatus.State.KILLED,\n    TaskStatus.State.KILLED_UNCLEAN, TaskStatus.State.RUNNING,\n    TaskStatus.State.SUCCEEDED, TaskStatus.State.UNASSIGNED);\nif (!CONVERTIBLE_STATES.contains(state)) { /* skip or log */ }","typeGuard":"static boolean isConvertibleAttemptState(org.apache.hadoop.mapred.TaskStatus.State s) {\n  return EnumSet.of(org.apache.hadoop.mapred.TaskStatus.State.COMMIT_PENDING,\n      org.apache.hadoop.mapred.TaskStatus.State.FAILED,\n      org.apache.hadoop.mapred.TaskStatus.State.FAILED_UNCLEAN,\n      org.apache.hadoop.mapred.TaskStatus.State.KILLED,\n      org.apache.hadoop.mapred.TaskStatus.State.KILLED_UNCLEAN,\n      org.apache.hadoop.mapred.TaskStatus.State.RUNNING,\n      org.apache.hadoop.mapred.TaskStatus.State.SUCCEEDED,\n      org.apache.hadoop.mapred.TaskStatus.State.UNASSIGNED).contains(s);\n}","tryCatchPattern":"try {\n  attemptState = TypeConverter.toYarn(taskStatus.getState());\n} catch (YarnRuntimeException e) {\n  LOG.warn(\"Unmappable attempt state {}\", taskStatus.getState());\n}","preventionTips":["Pin hadoop-mapreduce-client-core and client-common to the same release","In tests, use only real TaskStatus.State constants"],"tags":["hadoop","mapreduce","yarn","task-attempt-state","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"}