{"record":{"id":"c1a64d9e6e3607bb","repo":"apache/hadoop","slug":"unrecognized-phase","errorCode":null,"errorMessage":"Unrecognized Phase: {}","messagePattern":"Unrecognized Phase: (.+?)","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":190,"sourceCode":"\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:\n      break;\n    }\n    throw new YarnRuntimeException(\"Unrecognized Phase: \" + phase);\n  }\n\n  public static TaskCompletionEvent[] fromYarn(\n      TaskAttemptCompletionEvent[] newEvents) {\n    TaskCompletionEvent[] oldEvents =\n        new TaskCompletionEvent[newEvents.length];\n    int i = 0;\n    for (TaskAttemptCompletionEvent newEvent\n        : newEvents) {\n      oldEvents[i++] = fromYarn(newEvent);\n    }\n    return oldEvents;\n  }\n\n  public static TaskCompletionEvent fromYarn(\n      TaskAttemptCompletionEvent newEvent) {\n    return new TaskCompletionEvent(newEvent.getEventId(),\n              fromYarn(newEvent.getAttemptId()), newEvent.getAttemptId().getId(),","sourceCodeStart":172,"sourceCodeEnd":208,"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#L172-L208","documentation":"TypeConverter.toYarn(org.apache.hadoop.mapred.TaskStatus.Phase) maps the six classic phases (STARTING, MAP, SHUFFLE, SORT, REDUCE, CLEANUP) onto the YARN Phase enum and falls through to YarnRuntimeException for anything else. The classic Phase enum currently has exactly these six constants, so in a consistent build the throw is unreachable; hitting it means enum drift or an invalid Phase value reached the converter.","triggerScenarios":"Calling TypeConverter.toYarn(phase) with a Phase constant added by a newer client-core jar, or with a value produced by deserialization from a mismatched peer.","commonSituations":"Version-skewed Hadoop client jars; custom serialization layers that reconstruct TaskStatus.Phase from strings; fork/vendor distributions that extend Phase.","solutions":["Align mapreduce-client-core and client-common versions","Validate Phase.forName/toString round-trips before converting","Catch YarnRuntimeException at protocol boundaries and log the offending phase"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"private static final Set<TaskStatus.Phase> CONVERTIBLE_PHASES = EnumSet.of(\n    TaskStatus.Phase.STARTING, TaskStatus.Phase.MAP, TaskStatus.Phase.SHUFFLE,\n    TaskStatus.Phase.SORT, TaskStatus.Phase.REDUCE, TaskStatus.Phase.CLEANUP);\nif (!CONVERTIBLE_PHASES.contains(phase)) { /* skip */ }","typeGuard":"static boolean isConvertiblePhase(org.apache.hadoop.mapred.TaskStatus.Phase p) {\n  return EnumSet.allOf(org.apache.hadoop.mapred.TaskStatus.Phase.class).contains(p)\n      && p != null; // full enum is covered in a consistent build; guard for skew\n}","tryCatchPattern":"try {\n  yarnPhase = TypeConverter.toYarn(phase);\n} catch (YarnRuntimeException e) {\n  LOG.warn(\"Unmappable phase {}\", phase);\n}","preventionTips":["Avoid reconstructing Phase from raw strings across versions","Validate enum round-trips (valueOf/toString) after deserialization"],"tags":["hadoop","mapreduce","yarn","phase","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"}