apache/hadoop · error · IOException

Missing username: {}

Error message

Missing username: {}

What it means

RoundRobinUserResolver.parseUserList() reads the gridmix users file line by line in the form 'username[,group]*'. For each line it finds the first comma (rawUgi.find(",")); if the comma is at position 0 the line starts with a comma, meaning no username precedes it, and it throws IOException('Missing username: ' + line). Empty lines are skipped, so only a missing/blank username before the first comma triggers this.

Source

Thrown at hadoop-tools/hadoop-gridmix/src/main/java/org/apache/hadoop/mapred/gridmix/RoundRobinUserResolver.java:77

    }
    
    final Path userloc = new Path(userUri.toString());
    final Text rawUgi = new Text();
    final FileSystem fs = userloc.getFileSystem(conf);
    final ArrayList<UserGroupInformation> ugiList =
        new ArrayList<UserGroupInformation>();

    LineReader in = null;
    try {
      in = new LineReader(fs.open(userloc));
      while (in.readLine(rawUgi) > 0) {//line is of the form username[,group]*
        if(rawUgi.toString().trim().equals("")) {
          continue; //Continue on empty line
        }
        // e is end position of user name in this line
        int e = rawUgi.find(",");
        if (e == 0) {
          throw new IOException("Missing username: " + rawUgi);
        }
        if (e == -1) {
          e = rawUgi.getLength();
        }
        final String username = Text.decode(rawUgi.getBytes(), 0, e).trim();
        UserGroupInformation ugi = null;
        try {
          ugi = UserGroupInformation.createProxyUser(username,
                    UserGroupInformation.getLoginUser());
        } catch (IOException ioe) {
          LOG.error("Error while creating a proxy user " ,ioe);
        }
        if (ugi != null) {
          ugiList.add(ugi);
        }
        // No need to parse groups, even if they exist. Go to next line
      }
    } finally {

View on GitHub (pinned to 2add963021)

Solutions

  1. Fix the offending line shown in the message so it starts with a username: 'username[,group]*' (e.g. 'alice,hdfs,users')
  2. Audit every non-empty line of the users file for a leading comma or missing username
  3. Remove or correct blank-username lines; keep truly empty lines only if intentional (they are skipped)

Example fix

# before (users.txt)
,hdfs,supergroup
bob,analysts

# after
alice,hdfs,supergroup
bob,analysts
Defensive patterns

Strategy: validation

Validate before calling

// Validate gridmix users file before launching
for (String line : Files.readAllLines(usersFile)) {
  String t = line.trim();
  if (t.isEmpty()) continue;
  if (t.startsWith(",")) {
    throw new IllegalArgumentException("Line missing username: " + line);
  }
}

Try / catch

try {
  resolver.setTargetUsers(userloc, conf);
} catch (IOException e) {
  // message contains the offending raw line; fix that line in the users file
}

Prevention

When it happens

Trigger: Running gridmix with a user list (-g <trace> <users-file> or the RoundRobinUserResolver target users URI) where at least one non-empty line begins with ',', e.g. ',hdfs,supergroup' or ', groups'. LineReader + Text.find returns 0 for such lines and the exception is raised immediately during setTargetUsers().

Common situations: Hand-edited users.txt with a deleted username, a stray leading comma, or a transposed 'group,user' CSV row; files generated by scripts that emit commas first; copy-paste of /etc/group-style lines into the gridmix user list.

Related errors


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