juicedata/juicefs · error · IOException

Invalid ACL: only directories may have a default ACL

Error message

Invalid ACL: only directories may have a default ACL

What it means

Thrown in setAcl when a default-scope ACL entry is applied to a path that is not a directory. Default ACLs exist only to seed access ACLs on newly created children, so the local validation rejects default entries on regular files before calling jfs_setfacl.

Source

Thrown at sdk/java/src/main/java/io/juicefs/JuiceFileSystemImpl.java:2239

        buf.putByte(off, (byte) e.getPermission().ordinal());
        off += 1;
      }
    }
    for (AclEntry e : aclSpec) {
      String name = e.getName();
      if (name != null && e.getType() == AclEntryType.GROUP) {
        byte[] nb = name.getBytes("utf8");
        buf.putByte(off, (byte) nb.length);
        buf.put(off + 1, nb, 0, nb.length);
        off += 1 + nb.length;
        buf.putByte(off, (byte) e.getPermission().ordinal());
        off += 1;
      }
    }
    int r = lib.jfs_setfacl(Thread.currentThread().getId(), handle, normalizePath(path), scope.ordinal() + 1, buf,
        12 + namedaclsize);
    if (r == ENOTSUP) {
      throw new IOException("Invalid ACL: only directories may have a default ACL");
    }
    if (r < 0)
      throw error(r, path);
  }

  private List<AclEntry> getAclEntries(Path path, AclEntryScope scope) throws IOException {
    int bufsize = 1024;
    int r;
    Pointer buf;
    do {
      bufsize *= 2;
      buf = Memory.allocate(Runtime.getRuntime(lib), bufsize);
      r = lib.jfs_getfacl(Thread.currentThread().getId(), handle, normalizePath(path), scope.ordinal() + 1, buf,
          bufsize);
    } while (r == -100);
    if (r == ENOATTR || r == ENODATA) {
      return Lists.newArrayList();
    }

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Apply default ACLs only to directories; strip DEFAULT-scope entries from the aclSpec when targeting a file
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at sdk/java/src/main/java/io/juicefs/JuiceFileSystemImpl.java:2239 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06). Data as JSON: /api/errors/c98d95e1c1be12e1. Report an issue: GitHub.