{"record":{"id":"7866dc7d9d0b052e","repo":"apache/hadoop","slug":"name-cannot-be-null-or-emtpy-7866dc","errorCode":null,"errorMessage":"Name cannot be NULL or emtpy","messagePattern":"Name cannot be NULL or emtpy","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/mapreduce/lib/output/MultipleOutputs.java","lineNumber":223,"sourceCode":"\n  /**\n   * Cache for the taskContexts\n   */\n  private Map<String, TaskAttemptContext> taskContexts = new HashMap<String, TaskAttemptContext>();\n  /**\n   * Cached TaskAttemptContext which uses the job's configured settings\n   */\n  private TaskAttemptContext jobOutputFormatContext;\n\n  /**\n   * Checks if a named output name is valid token.\n   *\n   * @param namedOutput named output Name\n   * @throws IllegalArgumentException if the output name is not valid.\n   */\n  private static void checkTokenName(String namedOutput) {\n    if (namedOutput == null || namedOutput.length() == 0) {\n      throw new IllegalArgumentException(\n        \"Name cannot be NULL or emtpy\");\n    }\n    for (char ch : namedOutput.toCharArray()) {\n      if ((ch >= 'A') && (ch <= 'Z')) {\n        continue;\n      }\n      if ((ch >= 'a') && (ch <= 'z')) {\n        continue;\n      }\n      if ((ch >= '0') && (ch <= '9')) {\n        continue;\n      }\n      throw new IllegalArgumentException(\n        \"Name cannot be have a '\" + ch + \"' char\");\n    }\n  }\n\n  /**","sourceCodeStart":205,"sourceCodeEnd":241,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/lib/output/MultipleOutputs.java#L205-L241","documentation":"Thrown as IllegalArgumentException from MultipleOutputs.checkTokenName (MultipleOutputs.java:223). Every named-output channel name must be a non-empty string of letters and digits only; passing null or the empty string fails this first validation. (The message contains the upstream typo 'emtpy'.) It fires from addNamedOutput() at job setup and from write(namedOutput, ...) in the task.","triggerScenarios":"MultipleOutputs.addNamedOutput(job, null, ...) or addNamedOutput(job, \"\", ...); or mos.write(\"\", key, value) / mos.write(null, key, value) in a Mapper/Reducer. Typical origin: the name comes from user input, a config key, or string splitting that yielded an empty token.","commonSituations":"Generating channel names dynamically from data (e.g. split('|')[0] on an unexpected input line) and hitting an empty segment; passing an unvalidated parameter into a job-driver utility that calls addNamedOutput.","solutions":["Pass a non-empty, alphanumeric channel name (e.g. 'metrics', 'errors01')","Validate dynamically generated names before use: reject or default when null/empty","Centralize channel naming in one constant/enum so call sites cannot drift"],"exampleFix":"// before\nString channel = record.split(\"\\\\|\")[0]; // may be \"\" on malformed input\nmos.write(channel, key, value);\n\n// after\nString channel = record.split(\"\\\\|\")[0];\nif (channel == null || channel.isEmpty()) {\n  channel = \"default\";\n}\nmos.write(channel, key, value);","handlingStrategy":"validation","validationCode":"// guard channel names at their source\nstatic String requireChannelName(String raw) {\n  if (raw == null || raw.isEmpty()) throw new IllegalArgumentException(\"channel name required\");\n  return raw;\n}","typeGuard":"static boolean isValidMultipleOutputsToken(String name) {\n  if (name == null || name.isEmpty()) return false;\n  for (char ch : name.toCharArray()) {\n    if (!((ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z') || (ch >= '0' && ch <= '9'))) return false;\n  }\n  return !name.equals(\"part\");\n}","tryCatchPattern":null,"preventionTips":["Define channel names as constants","Validate data-derived names before mos.write","Fail fast in the driver, not in the task"],"tags":["hadoop","mapreduce","multiple-outputs","validation","illegalargument"],"backgroundTag":"invalid-named-output-name","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}