{"record":{"id":"10e8ff826af32646","repo":"apache/hadoop","slug":"invalid-acl-only-directories-may-have-a-default-a","errorCode":null,"errorMessage":"Invalid ACL: only directories may have a default ACL. Path: {inode.getFullPathName()}","messagePattern":"Invalid ACL: only directories may have a default ACL\\. Path: (.+?)","errorType":"exception","errorClass":"AclException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/AclStorage.java","lineNumber":283,"sourceCode":"   * @param newAcl {@code List<AclEntry>} containing new ACL entries\n   * @param snapshotId int latest snapshot ID of inode\n   * @throws AclException if the ACL is invalid for the given inode\n   * @throws QuotaExceededException if quota limit is exceeded\n   */\n  public static void updateINodeAcl(INode inode, List<AclEntry> newAcl,\n      int snapshotId) throws AclException, QuotaExceededException {\n    assert newAcl.size() >= 3;\n    FsPermission perm = inode.getFsPermission();\n    final FsPermission newPerm;\n    if (!AclUtil.isMinimalAcl(newAcl)) {\n      // This is an extended ACL.  Split entries into access vs. default.\n      ScopedAclEntries scoped = new ScopedAclEntries(newAcl);\n      List<AclEntry> accessEntries = scoped.getAccessEntries();\n      List<AclEntry> defaultEntries = scoped.getDefaultEntries();\n\n      // Only directories may have a default ACL.\n      if (!defaultEntries.isEmpty() && !inode.isDirectory()) {\n        throw new AclException(\n          \"Invalid ACL: only directories may have a default ACL. \"\n            + \"Path: \" + inode.getFullPathName());\n      }\n\n      // Attach entries to the feature.\n      if (inode.getAclFeature() != null) {\n        inode.removeAclFeature(snapshotId);\n      }\n      inode.addAclFeature(createAclFeature(accessEntries, defaultEntries),\n        snapshotId);\n      newPerm = createFsPermissionForExtendedAcl(accessEntries, perm);\n    } else {\n      // This is a minimal ACL.  Remove the ACL feature if it previously had one.\n      if (inode.getAclFeature() != null) {\n        inode.removeAclFeature(snapshotId);\n      }\n      newPerm = createFsPermissionForMinimalAcl(newAcl, perm);\n    }","sourceCodeStart":265,"sourceCodeEnd":301,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/AclStorage.java#L265-L301","documentation":"Error \"Invalid ACL: only directories may have a default ACL. Path: {inode.getFullPathName()}\" thrown in apache/hadoop.","triggerScenarios":"setAcl/modifyAcl on a file with a default ACL entry; default ACLs are only allowed on directories.","commonSituations":"See trigger scenarios.","solutions":["Apply the default ACL to a directory instead of a file.","Use only access ACL entries for files."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}