{"record":{"id":"c98d95e1c1be12e1","repo":"juicedata/juicefs","slug":"invalid-acl-only-directories-may-have-a-default-a","errorCode":null,"errorMessage":"Invalid ACL: only directories may have a default ACL","messagePattern":"Invalid ACL: only directories may have a default ACL","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"sdk/java/src/main/java/io/juicefs/JuiceFileSystemImpl.java","lineNumber":2239,"sourceCode":"        buf.putByte(off, (byte) e.getPermission().ordinal());\n        off += 1;\n      }\n    }\n    for (AclEntry e : aclSpec) {\n      String name = e.getName();\n      if (name != null && e.getType() == AclEntryType.GROUP) {\n        byte[] nb = name.getBytes(\"utf8\");\n        buf.putByte(off, (byte) nb.length);\n        buf.put(off + 1, nb, 0, nb.length);\n        off += 1 + nb.length;\n        buf.putByte(off, (byte) e.getPermission().ordinal());\n        off += 1;\n      }\n    }\n    int r = lib.jfs_setfacl(Thread.currentThread().getId(), handle, normalizePath(path), scope.ordinal() + 1, buf,\n        12 + namedaclsize);\n    if (r == ENOTSUP) {\n      throw new IOException(\"Invalid ACL: only directories may have a default ACL\");\n    }\n    if (r < 0)\n      throw error(r, path);\n  }\n\n  private List<AclEntry> getAclEntries(Path path, AclEntryScope scope) throws IOException {\n    int bufsize = 1024;\n    int r;\n    Pointer buf;\n    do {\n      bufsize *= 2;\n      buf = Memory.allocate(Runtime.getRuntime(lib), bufsize);\n      r = lib.jfs_getfacl(Thread.currentThread().getId(), handle, normalizePath(path), scope.ordinal() + 1, buf,\n          bufsize);\n    } while (r == -100);\n    if (r == ENOATTR || r == ENODATA) {\n      return Lists.newArrayList();\n    }","sourceCodeStart":2221,"sourceCodeEnd":2257,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/sdk/java/src/main/java/io/juicefs/JuiceFileSystemImpl.java#L2221-L2257","documentation":"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.","triggerScenarios":"Thrown at sdk/java/src/main/java/io/juicefs/JuiceFileSystemImpl.java:2239 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Apply default ACLs only to directories; strip DEFAULT-scope entries from the aclSpec when targeting a file"],"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"}