apache/hadoop · error · IllegalArgumentException

Named output name cannot be 'part'

Error message

Named output name cannot be 'part'

What it means

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.

Source

Thrown at hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/MultipleOutputs.java:220

      if ((ch >= '0') && (ch <= '9')) {
        continue;
      }
      throw new IllegalArgumentException(
        "Name cannot be have a '" + ch + "' char");
    }
  }

  /**
   * Checks if a named output name is valid.
   *
   * @param namedOutput named output Name
   * @throws IllegalArgumentException if the output name is not valid.
   */
  private static void checkNamedOutputName(String namedOutput) {
    checkTokenName(namedOutput);
    // name cannot be the name used for the default output
    if (namedOutput.equals("part")) {
      throw new IllegalArgumentException(
        "Named output name cannot be 'part'");
    }
  }

  /**
   * Returns list of channel names.
   *
   * @param conf job conf
   * @return List of channel Names
   */
  public static List<String> getNamedOutputsList(JobConf conf) {
    List<String> names = new ArrayList<String>();
    StringTokenizer st = new StringTokenizer(conf.get(NAMED_OUTPUTS, ""), " ");
    while (st.hasMoreTokens()) {
      names.add(st.nextToken());
    }
    return names;
  }

View on GitHub (pinned to 2add963021)

Solutions

  1. Pick a different name, e.g. 'partDefault', 'main', or the purpose of the channel
  2. If the goal is only to change the default output format/path, configure FileOutputFormat.setOutputPath / setOutputFormatClass instead of a named output
  3. If names are generated, block-list the reserved word before registering

Example fix

// before: reserved prefix
MultipleOutputs.addNamedOutput(conf, "part", TextOutputFormat.class, Text.class, Text.class);

// after: any non-reserved name
MultipleOutputs.addNamedOutput(conf, "partExtra", TextOutputFormat.class, Text.class, Text.class);
Defensive patterns

Strategy: validation

Validate before calling

static void addChannel(JobConf conf, String name, Class<? extends OutputFormat> f, Class<?> k, Class<?> v) {
  if ("part".equals(name)) throw new IllegalArgumentException("'part' is reserved; pick another channel name");
  MultipleOutputs.addNamedOutput(conf, name, f, k, v);
}

Prevention

When it happens

Trigger: MultipleOutputs.addNamedOutput(conf, "part", ...) or addMultiNamedOutput(conf, "part", ...). Also any generated/loop-driven registration that happens to produce the literal string 'part'.

Common situations: 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.

Related errors


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/683e1d25ae0fc8a8. Report an issue: GitHub.