apache/hadoop · error · UnsupportedOperationException
XAttrs are not supported on symlinks
Error message
XAttrs are not supported on symlinks
What it means
INodeSymlink.getXAttrFeature unconditionally throws UnsupportedOperationException("XAttrs are not supported on symlinks"). Reading extended attributes of a symlink inode (or internal logic that consults xattrs — encryption zone markers, raw xattr namespaces) reaches this method and fails, because symlink inodes carry no XAttrFeature storage.
Source
Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/INodeSymlink.java:129
@Override
public void accept(NamespaceVisitor visitor, int snapshot) {
visitor.visitSymlink(this, snapshot);
}
@Override
public void removeAclFeature() {
throw new UnsupportedOperationException("ACLs are not supported on symlinks");
}
@Override
public void addAclFeature(AclFeature f) {
throw new UnsupportedOperationException("ACLs are not supported on symlinks");
}
@Override
final XAttrFeature getXAttrFeature(int snapshotId) {
throw new UnsupportedOperationException("XAttrs are not supported on symlinks");
}
@Override
public void removeXAttrFeature() {
throw new UnsupportedOperationException("XAttrs are not supported on symlinks");
}
@Override
public void addXAttrFeature(XAttrFeature f) {
throw new UnsupportedOperationException("XAttrs are not supported on symlinks");
}
@Override
public byte getStoragePolicyID() {
throw new UnsupportedOperationException(
"Storage policy are not supported on symlinks");
}
View on GitHub (pinned to 2add963021)
Solutions
- Resolve the symlink target (FileContext/Path.resolve) and read xattrs from the destination
- Skip symlinks when enumerating xattrs across a tree
- Handle UnsupportedOperationException for symlinks explicitly so scans continue
Example fix
// before byte[] v = fs.getXAttr(path); // path is a symlink -> throws // after Path target = path.resolve(fs); // resolve link chain byte[] v = fs.getXAttr(target);
Defensive patterns
Strategy: type-guard
Validate before calling
FileStatus st = fs.getFileStatus(p); Path target = st.isSymlink() ? fs.getFileStatus(p).getSymlink() : p; Map<String, byte[]> xattrs = fs.getXAttrs(target);
Type guard
boolean xattrReadable(FileSystem fs, Path p) throws IOException {
return !fs.getFileStatus(p).isSymlink();
} Try / catch
catch (UnsupportedOperationException e) {
if (e.getMessage() != null && e.getMessage().contains("XAttrs are not supported on symlinks")) {
return Collections.emptyMap(); // links carry no xattrs by design
}
throw e;
} Prevention
- Resolve symlinks before xattr reads in audit/scanner tools
- Treat links as xattr-less entries in enumeration code
- Version your tooling against HDFS docs: xattrs exist only on files and directories
When it happens
Trigger: getXAttrs/getXAttr on a symlink path; internal attribute lookups (e.g. encryption zone or trusted-namespace checks) operating directly on a symlink inode rather than its resolved target.
Common situations: Audit/security scanners enumerating xattrs recursively over trees with symlinks; tooling that reads raw.* xattrs hitting compatibility links; distcp -p preserving xattrs.
Related errors
- ACLs are not supported on symlinks
- Storage policy are not supported on symlinks
- Operation not supported
- iip.getPath() + " is not a file or directory"
- Symlinks not supported - please remove symlink before upgrad
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/75cd256fe691efbb.
Report an issue: GitHub.