apache/hadoop · error · YarnRuntimeException
Unrecognized job state: {}
Error message
Unrecognized job state: {} What it means
TypeConverter.fromYarn(JobState) maps the MRv2 job states (NEW, INITED→PREP; RUNNING; SUCCEEDED; FAILED/ERROR→FAILED; KILLED) onto classic JobStatus run-states and throws YarnRuntimeException for anything unmapped. The MRv2 JobState enum currently has exactly those seven constants, so the throw fires only when a state arrives that this build of the converter does not know — the classic version-skew signature.
Source
Thrown at hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/TypeConverter.java:403
}
public static int fromYarn(JobState state) {
switch (state) {
case NEW:
case INITED:
return org.apache.hadoop.mapred.JobStatus.PREP;
case RUNNING:
return org.apache.hadoop.mapred.JobStatus.RUNNING;
case KILLED:
return org.apache.hadoop.mapred.JobStatus.KILLED;
case SUCCEEDED:
return org.apache.hadoop.mapred.JobStatus.SUCCEEDED;
case FAILED:
case ERROR:
return org.apache.hadoop.mapred.JobStatus.FAILED;
}
throw new YarnRuntimeException("Unrecognized job state: " + state);
}
public static org.apache.hadoop.mapred.TIPStatus fromYarn(
TaskState state) {
switch (state) {
case NEW:
case SCHEDULED:
return org.apache.hadoop.mapred.TIPStatus.PENDING;
case RUNNING:
return org.apache.hadoop.mapred.TIPStatus.RUNNING;
case KILLED:
return org.apache.hadoop.mapred.TIPStatus.KILLED;
case SUCCEEDED:
return org.apache.hadoop.mapred.TIPStatus.COMPLETE;
case FAILED:
return org.apache.hadoop.mapred.TIPStatus.FAILED;
}
throw new YarnRuntimeException("Unrecognized task state: " + state);View on GitHub (pinned to 2add963021)
Solutions
- Upgrade the client's hadoop-mapreduce-client-common to the cluster's version
- During rolling upgrades, keep the client at the highest cluster version
- Catch YarnRuntimeException when polling status and report the raw string
Defensive patterns
Strategy: type-guard
Validate before calling
private static final Set<JobState> KNOWN_JOB_STATES = EnumSet.of(
JobState.NEW, JobState.INITED, JobState.RUNNING, JobState.SUCCEEDED,
JobState.FAILED, JobState.KILLED, JobState.ERROR);
if (!KNOWN_JOB_STATES.contains(jobState)) { /* raw handling */ } Type guard
static boolean isMappableJobState(JobState s) {
return EnumSet.of(JobState.NEW, JobState.INITED, JobState.RUNNING,
JobState.SUCCEEDED, JobState.FAILED, JobState.KILLED,
JobState.ERROR).contains(s);
} Try / catch
try {
runState = TypeConverter.fromYarn(jobState);
} catch (YarnRuntimeException e) {
LOG.warn("Unknown job state {} from cluster; treating as RUNNING", jobState);
runState = JobStatus.RUNNING;
} Prevention
- During rolling upgrades, run clients at the newest cluster version
- Poll status through a helper that tolerates unknown states instead of raw TypeConverter
When it happens
Trigger: A job report from a newer MR AppMaster/JobHistory server carrying a JobState constant not present in this build's switch; mocked JobState values in tests.
Common situations: Down-level mapreduce-client-common talking to an upgraded cluster (rolling upgrade windows are the peak risk); third-party forks adding job states; client tools bundled with an application older than the cluster.
Related errors
- Unrecognized task type: {}
- Unrecognized State: {}
- Unrecognized Phase: {}
- Unrecognized status: {}
- Unrecognized task state: {}
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/ec0431aef6b22272.
Report an issue: GitHub.