apache/hadoop · error · IOException

Can't parse " + mapName + " list entry:" + line

Error message

Can't parse " + mapName + " list entry:" + line

What it means

ShellBasedIdMapping.updateMapInternal runs a shell command via 'bash -c' to dump users or groups (getent-style output), splits each line by a regex, and requires exactly two fields (name, id). Any line that does not split into exactly 2 parts throws IOException quoting the offending line, so the raw OS output can be inspected.

Source

Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ShellBasedIdMapping.java:239

   * @throws IOException raised on errors performing I/O.
   * @return updateMapInternal.
   */
  @VisibleForTesting
  public static boolean updateMapInternal(BiMap<Integer, String> map,
      String mapName, String command, String regex,
      Map<Integer, Integer> staticMapping) throws IOException  {
    boolean updated = false;
    BufferedReader br = null;
    try {
      Process process = Runtime.getRuntime().exec(
          new String[] { "bash", "-c", command });
      br = new BufferedReader(
          new InputStreamReader(process.getInputStream(), StandardCharsets.UTF_8));
      String line = null;
      while ((line = br.readLine()) != null) {
        String[] nameId = line.split(regex);
        if ((nameId == null) || (nameId.length != 2)) {
          throw new IOException("Can't parse " + mapName + " list entry:" + line);
        }
        LOG.debug("add to " + mapName + "map:" + nameId[0] + " id:" + nameId[1]);
        // HDFS can't differentiate duplicate names with simple authentication
        final Integer key = staticMapping.get(parseId(nameId[1]));
        final String value = nameId[0];
        if (map.containsKey(key)) {
          final String prevValue = map.get(key);
          if (value.equals(prevValue)) {
            // silently ignore equivalent entries
            continue;
          }
          reportDuplicateEntry(
              "Got multiple names associated with the same id: ",
              key, value, key, prevValue);           
          continue;
        }
        if (map.containsValue(value)) {
          final Integer prevKey = map.inverse().get(value);

View on GitHub (pinned to 2add963021)

Solutions

  1. Run the underlying dump manually ('getent passwd', 'getent group') on the node and locate the exact line shown in the exception
  2. Fix or exclude the malformed name-service entry (rename users/groups containing ':' or whitespace)
  3. For users/groups not present in the OS, use the static ID mapping file (IdMappingConstant.STATIC_ID_MAPPING_FILE_KEY, default /etc/nfs.static.map) instead of shell lookups
  4. Run the gateway/mapping on a standard Linux host or upgrade Hadoop for platform-specific parsing fixes
Defensive patterns

Strategy: try-catch

Validate before calling

Process p = new ProcessBuilder("bash", "-c", "getent passwd").start();
// pre-flight: confirm output lines split into exactly 2 fields before enabling the mapping
BufferedReader r = new BufferedReader(
    new InputStreamReader(p.getInputStream(), StandardCharsets.UTF_8));
String line;
while ((line = r.readLine()) != null) {
  if (line.split(":").length != 7) { /* not standard passwd format */ }
}

Try / catch

try {
  int uid = idMapping.getUid(user);
} catch (IOException e) {
  if (e.getMessage().startsWith("Can't parse")) {
    // log the offending line included in the message and alert on name-service health
  }
  throw e;
}

Prevention

When it happens

Trigger: The OS name service returns a malformed or unexpected line during map construction or incremental update: NIS/LDAP entries containing the separator in the name, wrapped or truncated getent output, or running the mapping on a platform whose tools do not emit standard passwd/group lines.

Common situations: NFS gateway / user-id mapping on hosts backed by NIS or LDAP with unusual entries; macOS or non-Linux dev machines where getent output differs; embedded environments with nonstandard bash/coreutils.

Related errors


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