apache/hadoop · error · XAttrsNotSupportedException

XAttrs not supported for file system: {uri}

Error message

XAttrs not supported for file system: {uri}

What it means

Pre-submission fail-fast check for XAttr preservation (-px): DistCpUtils.checkFileSystemXAttrSupport() calls fs.getXAttrs(new Path("/")) and, if it throws, raises CopyListing.XAttrsNotSupportedException (the DistCp CLI exits with XATTRS_NOT_SUPPORTED = -4). This prevents discovering mid-job that extended attributes cannot be preserved.

Source

Thrown at hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/util/DistCpUtils.java:516

        + fs.getUri());
    }
  }
  
  /**
   * Determines if a file system supports XAttrs by running a getXAttrs request
   * on the file system root. This method is used before distcp job submission
   * to fail fast if the user requested preserving XAttrs, but the file system
   * cannot support XAttrs.
   * 
   * @param fs FileSystem to check
   * @throws XAttrsNotSupportedException if fs does not support XAttrs
   */
  public static void checkFileSystemXAttrSupport(FileSystem fs)
      throws XAttrsNotSupportedException {
    try {
      fs.getXAttrs(new Path(Path.SEPARATOR));
    } catch (Exception e) {
      throw new XAttrsNotSupportedException("XAttrs not supported for file system: "
        + fs.getUri());
    }
  }

  /**
   * String utility to convert a number-of-bytes to human readable format.
   */
  private static final ThreadLocal<DecimalFormat> FORMATTER
                        = new ThreadLocal<DecimalFormat>() {
    @Override
    protected DecimalFormat initialValue() {
      return new DecimalFormat("0.0");
    }
  };

  public static DecimalFormat getFormatter() {
    return FORMATTER.get();
  }

View on GitHub (pinned to 2add963021)

Solutions

  1. Drop 'x' from the -p list when either endpoint lacks XAttr support
  2. For HDFS targets, confirm the version supports XAttrs and they are enabled
  3. Probe before submitting: fs.getXAttrs(new Path("/")) in a try/catch
  4. If XAttrs are required, keep the destination on an XAttr-capable filesystem such as HDFS

Example fix

# before: S3A target has no XAttrs -> XAttrsNotSupportedException
hadoop distcp -p x hdfs://nn/src s3a://bucket/dst

# after
hadoop distcp -p hdfs://nn/src s3a://bucket/dst
Defensive patterns

Strategy: validation

Validate before calling

static boolean supportsXAttrs(FileSystem fs) {
  try {
    fs.getXAttrs(new Path(Path.SEPARATOR));
    return true;
  } catch (Exception e) {
    return false;
  }
}
// drop FileAttribute.XATTR from -p when supportsXAttrs(source/target) is false

Try / catch

try {
  new DistCp(options, conf).execute();
} catch (CopyListing.XAttrsNotSupportedException e) {
  // retry with 'x' removed from the preserve set (CLI exits -4 instead)
}

Prevention

When it happens

Trigger: -px against a filesystem without XAttr support (most object stores, local FS, older HDFS builds); XAttrs disabled on HDFS; raw.* xattr copying (.reserved/raw) against a non-HDFS target; getXAttrs failing on the root path.

Common situations: HDFS-to-S3 replication pipelines carrying -px; security tooling that depends on raw.* xattrs; mixed-version clusters where only one side supports XAttrs.

Related errors


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/e71dae79a65f197f. Report an issue: GitHub.