apache/hadoop · error · YarnRuntimeException
Unknown task symbol: {}
Error message
Unknown task symbol: {} What it means
MRApps.taskType(String) translates the one-letter task symbols used in MRv2 task/attempt IDs and web query parameters: only 'm' (MAP) and 'r' (REDUCE) are legal; anything else throws YarnRuntimeException. It is called from the MR AppMaster and JobHistory web UI/REST layer to parse the task-type request parameter, so the exception surfaces as a failed web request when the parameter is wrong.
Source
Thrown at hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/v2/util/MRApps.java:158
PENDING(new TaskState[]{TaskState.SCHEDULED}),
COMPLETED(new TaskState[]{TaskState.SUCCEEDED, TaskState.FAILED, TaskState.KILLED});
private final List<TaskState> correspondingStates;
private TaskStateUI(TaskState[] correspondingStates) {
this.correspondingStates = Arrays.asList(correspondingStates);
}
public boolean correspondsTo(TaskState state) {
return this.correspondingStates.contains(state);
}
}
public static TaskType taskType(String symbol) {
// JDK 7 supports switch on strings
if (symbol.equals("m")) return TaskType.MAP;
if (symbol.equals("r")) return TaskType.REDUCE;
throw new YarnRuntimeException("Unknown task symbol: "+ symbol);
}
public static TaskAttemptStateUI taskAttemptState(String attemptStateStr) {
return TaskAttemptStateUI.valueOf(attemptStateStr);
}
public static TaskStateUI taskState(String taskStateStr) {
return TaskStateUI.valueOf(taskStateStr);
}
// gets the base name of the MapReduce framework or null if no
// framework was configured
private static String getMRFrameworkName(Configuration conf) {
String frameworkName = null;
String framework =
conf.get(MRJobConfig.MAPREDUCE_APPLICATION_FRAMEWORK_PATH, "");
if (!framework.isEmpty()) {
URI uri;View on GitHub (pinned to 2add963021)
Solutions
- Use the one-letter symbols: type=m for maps, type=r for reduces
- Omit the type parameter entirely to list all tasks
- When scripting against the API, validate the param against ^[mr]$ before issuing the request
Example fix
# before GET /ws/v1/mapreduce/jobs/job_1400_0001/tasks?type=map # after GET /ws/v1/mapreduce/jobs/job_1400_0001/tasks?type=m
Defensive patterns
Strategy: validation
Validate before calling
static boolean isValidTaskSymbol(String s) {
return "m".equals(s) || "r".equals(s);
}
// in REST clients / scrapers: validate ?type= before calling the MR web APIs Type guard
static boolean isValidTaskSymbol(String s) {
return "m".equals(s) || "r".equals(s);
} Try / catch
try {
TaskType t = MRApps.taskType(typeParam);
} catch (YarnRuntimeException e) {
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
// "type must be 'm' or 'r'"
} Prevention
- Use only 'm' or 'r' for the tasks type parameter (or omit it)
- Remember setup/cleanup tasks are not selectable through this symbol API
When it happens
Trigger: Hitting AM or JHS endpoints with an invalid type parameter, e.g. GET /proxy/application_1/ws/v1/mapreduce/jobs/job_1/tasks?type=map or ?type=setup (full words and setup/cleanup symbols are rejected); same for JSP pages like tasks.jsp?type=x.
Common situations: Scripts or monitoring dashboards scraping MR web UIs passing 'map'/'reduce' instead of 'm'/'r'; humans typing the full word into the URL; curl examples copied from other REST APIs (e.g. YARN's own, which spells types differently).
Related errors
- Unrecognized task type: {}
- startedTimeEnd must be greater than 0
- startedTimeEnd must be greater than startTimeBegin
- finishedTimeBegin must be greater than 0
- finishedTimeEnd must be greater than 0
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/4c25153cb2154a11.
Report an issue: GitHub.