apache/hadoop · warning · IOException

owner == null && group == null

Error message

owner == null && group == null

What it means

setOwner in WebHdfsFileSystem requires that at least one of owner and group be non-null. Passing null for both would issue a SETOWNER request that changes nothing, so the client rejects it with IOException before incrementing write statistics or contacting the NameNode. Set either a new owner, a new group, or both.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java:1282

      List<String> decodeResponse(Map<?, ?> json) throws IOException {
        return JsonUtilClient.toXAttrNames(json);
      }
    }.run();
  }

  @Override
  public void removeXAttr(Path p, String name) throws IOException {
    statistics.incrementWriteOps(1);
    storageStatistics.incrementOpCounter(OpType.REMOVE_XATTR);
    final HttpOpParam.Op op = PutOpParam.Op.REMOVEXATTR;
    new FsPathRunner(op, p, new XAttrNameParam(name)).run();
  }

  @Override
  public void setOwner(final Path p, final String owner, final String group
  ) throws IOException {
    if (owner == null && group == null) {
      throw new IOException("owner == null && group == null");
    }

    statistics.incrementWriteOps(1);
    storageStatistics.incrementOpCounter(OpType.SET_OWNER);
    final HttpOpParam.Op op = PutOpParam.Op.SETOWNER;
    new FsPathRunner(op, p,
        new OwnerParam(owner), new GroupParam(group)
    ).run();
  }

  @Override
  public void setPermission(final Path p, final FsPermission permission
  ) throws IOException {
    statistics.incrementWriteOps(1);
    storageStatistics.incrementOpCounter(OpType.SET_PERMISSION);
    final HttpOpParam.Op op = PutOpParam.Op.SETPERMISSION;
    new FsPathRunner(op, p,new PermissionParam(permission)).run();
  }

View on GitHub (pinned to 2add963021)

Solutions

  1. Skip the setOwner call when owner == null && group == null.
  2. Require at least one non-null value at the application boundary and fail with a clear validation message.
  3. If only one field should change, pass the current or desired value for that field and null for the field to leave unchanged.
  4. Add a unit test for the no-change case in code that forwards user-supplied ownership metadata.

Example fix

// before
fs.setOwner(path, owner, group); // both may be null

// after
if (owner != null || group != null) {
  fs.setOwner(path, owner, group);
}
Defensive patterns

Strategy: validation

Validate before calling

if (owner == null && group == null) {
  throw new IllegalArgumentException("setOwner requires a non-null owner or group; skip the call for no-op updates");
}

Try / catch

try {
  fs.setOwner(path, owner, group);
} catch (IOException e) {
  if ("owner == null && group == null".equals(e.getMessage())) {
    throw new IllegalArgumentException("Ownership update requested without an owner or group", e);
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling fs.setOwner(path, owner, group) where both arguments are null. This commonly happens when optional owner and group values are read from configuration or a request object and neither was populated.

Common situations: A generic metadata-sync utility calls setOwner for every file even when no owner/group change was requested; empty form or CLI fields become null; refactoring a signature leaves a stale null argument.

Related errors


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