{"record":{"id":"723c11aa854e0455","repo":"juicedata/juicefs","slug":"user-can-not-be-null","errorCode":null,"errorMessage":"User can not be null","messagePattern":"User can not be null","errorType":"exception","errorClass":"AccessControlException","httpStatus":null,"severity":"error","filePath":"sdk/java/src/main/java/io/juicefs/JuiceFileSystemImpl.java","lineNumber":1947,"sourceCode":"  }\n\n  @Override\n  public void setPermission(Path p, FsPermission permission) throws IOException {\n    if (needCheckPermission() && !checkOwner(p, \"setPermission\")) {\n      superGroupFileSystem.setPermission(p, permission);\n      return;\n    }\n    statistics.incrementWriteOps(1);\n    int r = lib.jfs_chmod(Thread.currentThread().getId(), handle, normalizePath(p), permission.toShort());\n    if (r != 0)\n      throw error(r, p);\n  }\n\n  @Override\n  public void setOwner(Path p, String username, String groupname) throws IOException {\n    if (needCheckPermission()) {\n      if (username == null) {\n        throw new AccessControlException(\n            \"User can not be null\");\n      }\n      if (!superuser.equals(username)) {\n        throw new AccessControlException(\n            \"Only SuperUser can do setOwner Action, the current user is \" + username);\n      }\n      superGroupFileSystem.setOwner(p, username, groupname);\n      return;\n    }\n    statistics.incrementWriteOps(1);\n    int r = lib.jfs_setOwner(Thread.currentThread().getId(), handle, normalizePath(p), username, groupname);\n    if (r != 0)\n      throw error(r, p);\n  }\n\n  @Override\n  public void setTimes(Path p, long mtime, long atime) throws IOException {\n    if (needCheckPermission() && !checkPathAccess(p, FsAction.WRITE, \"setTimes\")) {","sourceCodeStart":1929,"sourceCodeEnd":1965,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/sdk/java/src/main/java/io/juicefs/JuiceFileSystemImpl.java#L1929-L1965","documentation":"Thrown by setOwner in the JuiceFS Hadoop client when permission checking is enabled and the caller invokes setOwner with a null username. The underlying guard rejects the call before any metadata change because an ownership change requires a target user; passing null usually means the caller only wanted to change the group, which this path does not support.","triggerScenarios":"Thrown at sdk/java/src/main/java/io/juicefs/JuiceFileSystemImpl.java:1947 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a non-null username to FileSystem.setOwner; to change only the group, still supply the current owner as the username","Disable JuiceFS-side permission checking (juicefs.users/group or related config) so ownership enforcement is delegated to the filesystem"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}