{"record":{"id":"683e1d25ae0fc8a8","repo":"apache/hadoop","slug":"named-output-name-cannot-be-part","errorCode":null,"errorMessage":"Named output name cannot be 'part'","messagePattern":"Named output name cannot be 'part'","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/MultipleOutputs.java","lineNumber":220,"sourceCode":"      if ((ch >= '0') && (ch <= '9')) {\n        continue;\n      }\n      throw new IllegalArgumentException(\n        \"Name cannot be have a '\" + ch + \"' char\");\n    }\n  }\n\n  /**\n   * Checks if a named output name is valid.\n   *\n   * @param namedOutput named output Name\n   * @throws IllegalArgumentException if the output name is not valid.\n   */\n  private static void checkNamedOutputName(String namedOutput) {\n    checkTokenName(namedOutput);\n    // name cannot be the name used for the default output\n    if (namedOutput.equals(\"part\")) {\n      throw new IllegalArgumentException(\n        \"Named output name cannot be 'part'\");\n    }\n  }\n\n  /**\n   * Returns list of channel names.\n   *\n   * @param conf job conf\n   * @return List of channel Names\n   */\n  public static List<String> getNamedOutputsList(JobConf conf) {\n    List<String> names = new ArrayList<String>();\n    StringTokenizer st = new StringTokenizer(conf.get(NAMED_OUTPUTS, \"\"), \" \");\n    while (st.hasMoreTokens()) {\n      names.add(st.nextToken());\n    }\n    return names;\n  }","sourceCodeStart":202,"sourceCodeEnd":238,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/MultipleOutputs.java#L202-L238","documentation":"checkNamedOutputName() in MultipleOutputs rejects the exact name 'part' for a named output because 'part' is the file-name prefix reserved for the job's default output files (part-00000, part-00001, ...). Allowing a named output called 'part' would collide with those default files. The IllegalArgumentException is thrown from addNamedOutput/addMultiNamedOutput during job setup.","triggerScenarios":"MultipleOutputs.addNamedOutput(conf, \"part\", ...) or addMultiNamedOutput(conf, \"part\", ...). Also any generated/loop-driven registration that happens to produce the literal string 'part'.","commonSituations":"Generic job templates that derive output channel names from configuration or file names and occasionally produce 'part'; teams migrating jobs where the intent was to override the default output rather than add a named output.","solutions":["Pick a different name, e.g. 'partDefault', 'main', or the purpose of the channel","If the goal is only to change the default output format/path, configure FileOutputFormat.setOutputPath / setOutputFormatClass instead of a named output","If names are generated, block-list the reserved word before registering"],"exampleFix":"// before: reserved prefix\nMultipleOutputs.addNamedOutput(conf, \"part\", TextOutputFormat.class, Text.class, Text.class);\n\n// after: any non-reserved name\nMultipleOutputs.addNamedOutput(conf, \"partExtra\", TextOutputFormat.class, Text.class, Text.class);","handlingStrategy":"validation","validationCode":"static void addChannel(JobConf conf, String name, Class<? extends OutputFormat> f, Class<?> k, Class<?> v) {\n  if (\"part\".equals(name)) throw new IllegalArgumentException(\"'part' is reserved; pick another channel name\");\n  MultipleOutputs.addNamedOutput(conf, name, f, k, v);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never name a channel 'part' — that prefix belongs to the default output files","Block-list reserved words wherever channel names are generated from config or filenames","If you meant to change the default output, use FileOutputFormat settings instead of named outputs"],"tags":["hadoop","mapreduce","multiple-outputs","reserved-name","naming"],"backgroundTag":"reserved-name-collision","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}