{"record":{"id":"b46f76fefea61816","repo":"apache/hadoop","slug":"missing-username","errorCode":null,"errorMessage":"Missing username: {}","messagePattern":"Missing username: (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-tools/hadoop-gridmix/src/main/java/org/apache/hadoop/mapred/gridmix/RoundRobinUserResolver.java","lineNumber":77,"sourceCode":"    }\n    \n    final Path userloc = new Path(userUri.toString());\n    final Text rawUgi = new Text();\n    final FileSystem fs = userloc.getFileSystem(conf);\n    final ArrayList<UserGroupInformation> ugiList =\n        new ArrayList<UserGroupInformation>();\n\n    LineReader in = null;\n    try {\n      in = new LineReader(fs.open(userloc));\n      while (in.readLine(rawUgi) > 0) {//line is of the form username[,group]*\n        if(rawUgi.toString().trim().equals(\"\")) {\n          continue; //Continue on empty line\n        }\n        // e is end position of user name in this line\n        int e = rawUgi.find(\",\");\n        if (e == 0) {\n          throw new IOException(\"Missing username: \" + rawUgi);\n        }\n        if (e == -1) {\n          e = rawUgi.getLength();\n        }\n        final String username = Text.decode(rawUgi.getBytes(), 0, e).trim();\n        UserGroupInformation ugi = null;\n        try {\n          ugi = UserGroupInformation.createProxyUser(username,\n                    UserGroupInformation.getLoginUser());\n        } catch (IOException ioe) {\n          LOG.error(\"Error while creating a proxy user \" ,ioe);\n        }\n        if (ugi != null) {\n          ugiList.add(ugi);\n        }\n        // No need to parse groups, even if they exist. Go to next line\n      }\n    } finally {","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-tools/hadoop-gridmix/src/main/java/org/apache/hadoop/mapred/gridmix/RoundRobinUserResolver.java#L59-L95","documentation":"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.","triggerScenarios":"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().","commonSituations":"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.","solutions":["Fix the offending line shown in the message so it starts with a username: 'username[,group]*' (e.g. 'alice,hdfs,users')","Audit every non-empty line of the users file for a leading comma or missing username","Remove or correct blank-username lines; keep truly empty lines only if intentional (they are skipped)"],"exampleFix":"# before (users.txt)\n,hdfs,supergroup\nbob,analysts\n\n# after\nalice,hdfs,supergroup\nbob,analysts","handlingStrategy":"validation","validationCode":"// Validate gridmix users file before launching\nfor (String line : Files.readAllLines(usersFile)) {\n  String t = line.trim();\n  if (t.isEmpty()) continue;\n  if (t.startsWith(\",\")) {\n    throw new IllegalArgumentException(\"Line missing username: \" + line);\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  resolver.setTargetUsers(userloc, conf);\n} catch (IOException e) {\n  // message contains the offending raw line; fix that line in the users file\n}","preventionTips":["Lint the users file for leading commas before every gridmix run","Generate user lists programmatically in 'username[,group]*' format rather than hand-editing"],"tags":["hadoop","gridmix","user-resolver","config-file","parse-error"],"backgroundTag":"malformed-config-file","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}