apache/hadoop · error · UnsupportedOperationException
{} doesn't support getXAttr
Error message
{} doesn't support getXAttr What it means
FileSystem.getXAttr(Path, String) is optional; the base class throws UnsupportedOperationException with getClass().getSimpleName() + " doesn't support getXAttr". It reads one named xattr; implemented by the HDFS-family clients (DistributedFileSystem, WebHdfsFileSystem, HttpFSFileSystem) and pass-through wrappers, not by local filesystem or the common object-store connectors.
Source
Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java:3286
+ " doesn't support setXAttr");
}
/**
* Get an xattr name and value for a file or directory.
* The name must be prefixed with the namespace followed by ".". For example,
* "user.attr".
* <p>
* Refer to the HDFS extended attributes user documentation for details.
*
* @param path Path to get extended attribute
* @param name xattr name.
* @return byte[] xattr value.
* @throws IOException IO failure
* @throws UnsupportedOperationException if the operation is unsupported
* (default outcome).
*/
public byte[] getXAttr(Path path, String name) throws IOException {
throw new UnsupportedOperationException(getClass().getSimpleName()
+ " doesn't support getXAttr");
}
/**
* Get all of the xattr name/value pairs for a file or directory.
* Only those xattrs which the logged-in user has permissions to view
* are returned.
* <p>
* Refer to the HDFS extended attributes user documentation for details.
*
* @param path Path to get extended attributes
* @return Map describing the XAttrs of the file or directory
* @throws IOException IO failure
* @throws UnsupportedOperationException if the operation is unsupported
* (default outcome).
*/
public Map<String, byte[]> getXAttrs(Path path) throws IOException {
throw new UnsupportedOperationException(getClass().getSimpleName()View on GitHub (pinned to 2add963021)
Solutions
- Probe fs.hasPathCapability(path, CommonPathCapabilities.FS_XATTRS) before reading
- Store the same metadata in a sidecar file or catalog for non-HDFS paths and read from there
- Catch UnsupportedOperationException and treat the file as untagged (safe default) rather than failing the job
- Scope attribute-reading code to hdfs:// URIs
Example fix
// before
byte[] tag = fs.getXAttr(path, "user.ranger.tag"); // throws
// after
byte[] tag = null;
if (fs.hasPathCapability(path, CommonPathCapabilities.FS_XATTRS)) {
tag = fs.getXAttr(path, "user.ranger.tag");
} else {
tag = readSidecar(path, "ranger.tag"); // null when untagged
} Defensive patterns
Strategy: try-catch
Validate before calling
byte[] value = null;
if (fs.hasPathCapability(path, CommonPathCapabilities.FS_XATTRS)) {
value = fs.getXAttr(path, name);
} else {
value = readSidecar(path, name); // null when untagged
} Type guard
static boolean supportsXattrRead(FileSystem fs) {
return fs instanceof DistributedFileSystem
|| fs instanceof WebHdfsFileSystem;
} Try / catch
try {
return fs.getXAttr(path, name);
} catch (UnsupportedOperationException e) {
return null; // store has no xattrs: treat file as untagged
} Prevention
- Policy/tag readers should treat 'store has no xattrs' as untagged, not fatal
- Read tags from an external catalog when paths may live on object stores
- Scope xattr reads to hdfs:// URIs in mixed-scheme deployments
When it happens
Trigger: Calling fs.getXAttr(path, name) on file://, s3a://, gs://, har:// or a custom FileSystem; annotation/policy readers that fetch a specific attribute (e.g., "user.ranger.tag") for every file processed.
Common situations: Policy engines reading tags from paths that include non-HDFS mounts; tooling developed against HDFS and reused after a partial migration to object storage.
Related errors
- {} doesn't support setXAttr
- {} doesn't support getXAttrs
- {} doesn't support listXAttrs
- {} doesn't support removeXAttr
- {} doesn't support satisfyStoragePolicy
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/09b8d30f45d77745.
Report an issue: GitHub.