apache/hadoop · error · YarnRuntimeException
Unrecognized State: {}
Error message
Unrecognized State: {} What it means
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.
Source
Thrown at hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/TypeConverter.java:169
public static TaskAttemptState toYarn(
org.apache.hadoop.mapred.TaskStatus.State state) {
switch (state) {
case COMMIT_PENDING:
return TaskAttemptState.COMMIT_PENDING;
case FAILED:
case FAILED_UNCLEAN:
return TaskAttemptState.FAILED;
case KILLED:
case KILLED_UNCLEAN:
return TaskAttemptState.KILLED;
case RUNNING:
return TaskAttemptState.RUNNING;
case SUCCEEDED:
return TaskAttemptState.SUCCEEDED;
case UNASSIGNED:
return TaskAttemptState.STARTING;
default:
throw new YarnRuntimeException("Unrecognized State: " + state);
}
}
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:View on GitHub (pinned to 2add963021)
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
Defensive patterns
Strategy: type-guard
Validate before calling
private static final Set<TaskStatus.State> CONVERTIBLE_STATES = EnumSet.of(
TaskStatus.State.COMMIT_PENDING, TaskStatus.State.FAILED,
TaskStatus.State.FAILED_UNCLEAN, TaskStatus.State.KILLED,
TaskStatus.State.KILLED_UNCLEAN, TaskStatus.State.RUNNING,
TaskStatus.State.SUCCEEDED, TaskStatus.State.UNASSIGNED);
if (!CONVERTIBLE_STATES.contains(state)) { /* skip or log */ } Type guard
static boolean isConvertibleAttemptState(org.apache.hadoop.mapred.TaskStatus.State s) {
return EnumSet.of(org.apache.hadoop.mapred.TaskStatus.State.COMMIT_PENDING,
org.apache.hadoop.mapred.TaskStatus.State.FAILED,
org.apache.hadoop.mapred.TaskStatus.State.FAILED_UNCLEAN,
org.apache.hadoop.mapred.TaskStatus.State.KILLED,
org.apache.hadoop.mapred.TaskStatus.State.KILLED_UNCLEAN,
org.apache.hadoop.mapred.TaskStatus.State.RUNNING,
org.apache.hadoop.mapred.TaskStatus.State.SUCCEEDED,
org.apache.hadoop.mapred.TaskStatus.State.UNASSIGNED).contains(s);
} Try / catch
try {
attemptState = TypeConverter.toYarn(taskStatus.getState());
} catch (YarnRuntimeException e) {
LOG.warn("Unmappable attempt state {}", taskStatus.getState());
} Prevention
- Pin hadoop-mapreduce-client-core and client-common to the same release
- In tests, use only real TaskStatus.State constants
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Unrecognized task type: {}
- Unrecognized Phase: {}
- Unrecognized status: {}
- Unrecognized job state: {}
- Unrecognized task state: {}
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/1ed231e443436120.
Report an issue: GitHub.