{"record":{"id":"4c25153cb2154a11","repo":"apache/hadoop","slug":"unknown-task-symbol","errorCode":null,"errorMessage":"Unknown task symbol: {}","messagePattern":"Unknown task symbol: (.+?)","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/v2/util/MRApps.java","lineNumber":158,"sourceCode":"    PENDING(new TaskState[]{TaskState.SCHEDULED}),\n    COMPLETED(new TaskState[]{TaskState.SUCCEEDED, TaskState.FAILED, TaskState.KILLED});\n\n    private final List<TaskState> correspondingStates;\n\n    private TaskStateUI(TaskState[] correspondingStates) {\n      this.correspondingStates = Arrays.asList(correspondingStates);\n    }\n\n    public boolean correspondsTo(TaskState state) {\n      return this.correspondingStates.contains(state);\n    }\n  }\n\n  public static TaskType taskType(String symbol) {\n    // JDK 7 supports switch on strings\n    if (symbol.equals(\"m\")) return TaskType.MAP;\n    if (symbol.equals(\"r\")) return TaskType.REDUCE;\n    throw new YarnRuntimeException(\"Unknown task symbol: \"+ symbol);\n  }\n\n  public static TaskAttemptStateUI taskAttemptState(String attemptStateStr) {\n    return TaskAttemptStateUI.valueOf(attemptStateStr);\n  }\n\n  public static TaskStateUI taskState(String taskStateStr) {\n    return TaskStateUI.valueOf(taskStateStr);\n  }\n\n  // gets the base name of the MapReduce framework or null if no\n  // framework was configured\n  private static String getMRFrameworkName(Configuration conf) {\n    String frameworkName = null;\n    String framework =\n        conf.get(MRJobConfig.MAPREDUCE_APPLICATION_FRAMEWORK_PATH, \"\");\n    if (!framework.isEmpty()) {\n      URI uri;","sourceCodeStart":140,"sourceCodeEnd":176,"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/v2/util/MRApps.java#L140-L176","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","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"],"exampleFix":"# before\nGET /ws/v1/mapreduce/jobs/job_1400_0001/tasks?type=map\n\n# after\nGET /ws/v1/mapreduce/jobs/job_1400_0001/tasks?type=m","handlingStrategy":"validation","validationCode":"static boolean isValidTaskSymbol(String s) {\n  return \"m\".equals(s) || \"r\".equals(s);\n}\n// in REST clients / scrapers: validate ?type= before calling the MR web APIs","typeGuard":"static boolean isValidTaskSymbol(String s) {\n  return \"m\".equals(s) || \"r\".equals(s);\n}","tryCatchPattern":"try {\n  TaskType t = MRApps.taskType(typeParam);\n} catch (YarnRuntimeException e) {\n  response.setStatus(HttpServletResponse.SC_BAD_REQUEST);\n  // \"type must be 'm' or 'r'\"\n}","preventionTips":["Use only 'm' or 'r' for the tasks type parameter (or omit it)","Remember setup/cleanup tasks are not selectable through this symbol API"],"tags":["hadoop","mapreduce","rest-api","web-ui","query-param","task-type"],"backgroundTag":"invalid-query-parameter","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}