apache/hadoop · error · YarnRuntimeException
Unrecognized Phase: {}
Error message
Unrecognized Phase: {} What it means
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.
Source
Thrown at hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/TypeConverter.java:190
public static Phase toYarn(org.apache.hadoop.mapred.TaskStatus.Phase phase) {
switch (phase) {
case STARTING:
return Phase.STARTING;
case MAP:
return Phase.MAP;
case SHUFFLE:
return Phase.SHUFFLE;
case SORT:
return Phase.SORT;
case REDUCE:
return Phase.REDUCE;
case CLEANUP:
return Phase.CLEANUP;
default:
break;
}
throw new YarnRuntimeException("Unrecognized Phase: " + phase);
}
public static TaskCompletionEvent[] fromYarn(
TaskAttemptCompletionEvent[] newEvents) {
TaskCompletionEvent[] oldEvents =
new TaskCompletionEvent[newEvents.length];
int i = 0;
for (TaskAttemptCompletionEvent newEvent
: newEvents) {
oldEvents[i++] = fromYarn(newEvent);
}
return oldEvents;
}
public static TaskCompletionEvent fromYarn(
TaskAttemptCompletionEvent newEvent) {
return new TaskCompletionEvent(newEvent.getEventId(),
fromYarn(newEvent.getAttemptId()), newEvent.getAttemptId().getId(),View on GitHub (pinned to 2add963021)
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
Defensive patterns
Strategy: type-guard
Validate before calling
private static final Set<TaskStatus.Phase> CONVERTIBLE_PHASES = EnumSet.of(
TaskStatus.Phase.STARTING, TaskStatus.Phase.MAP, TaskStatus.Phase.SHUFFLE,
TaskStatus.Phase.SORT, TaskStatus.Phase.REDUCE, TaskStatus.Phase.CLEANUP);
if (!CONVERTIBLE_PHASES.contains(phase)) { /* skip */ } Type guard
static boolean isConvertiblePhase(org.apache.hadoop.mapred.TaskStatus.Phase p) {
return EnumSet.allOf(org.apache.hadoop.mapred.TaskStatus.Phase.class).contains(p)
&& p != null; // full enum is covered in a consistent build; guard for skew
} Try / catch
try {
yarnPhase = TypeConverter.toYarn(phase);
} catch (YarnRuntimeException e) {
LOG.warn("Unmappable phase {}", phase);
} Prevention
- Avoid reconstructing Phase from raw strings across versions
- Validate enum round-trips (valueOf/toString) after deserialization
When it happens
Trigger: 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.
Common situations: Version-skewed Hadoop client jars; custom serialization layers that reconstruct TaskStatus.Phase from strings; fork/vendor distributions that extend Phase.
Related errors
- Unrecognized task type: {}
- Unrecognized State: {}
- Unrecognized status: {}
- Unrecognized job state: {}
- Unrecognized task state: {}
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/c1a64d9e6e3607bb.
Report an issue: GitHub.