{"record":{"id":"7ce10ae1581948a7","repo":"apache/hadoop","slug":"doesn-t-support-getxattr","errorCode":null,"errorMessage":"{} doesn't support getXAttr","messagePattern":"(.+?) doesn't support getXAttr","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/AbstractFileSystem.java","lineNumber":1396,"sourceCode":"      EnumSet<XAttrSetFlag> flag) throws IOException {\n    throw new UnsupportedOperationException(getClass().getSimpleName()\n        + \" doesn't support setXAttr\");\n  }\n\n  /**\n   * Get an xattr for a file or directory.\n   * The name must be prefixed with the namespace followed by \".\". For example,\n   * \"user.attr\".\n   * <p>\n   * Refer to the HDFS extended attributes user documentation for details.\n   *\n   * @param path Path to get extended attribute\n   * @param name xattr name.\n   * @return byte[] xattr value.\n   * @throws IOException raised on errors performing I/O.\n   */\n  public byte[] getXAttr(Path path, String name) throws IOException {\n    throw new UnsupportedOperationException(getClass().getSimpleName()\n        + \" doesn't support getXAttr\");\n  }\n\n  /**\n   * Get all of the xattrs for a file or directory.\n   * Only those xattrs for which the logged-in user has permissions to view\n   * are returned.\n   * <p>\n   * Refer to the HDFS extended attributes user documentation for details.\n   *\n   * @param path Path to get extended attributes\n   *\n   * @return {@literal Map<String, byte[]>} describing the XAttrs of the file\n   * or directory\n   * @throws IOException raised on errors performing I/O.\n   */\n  public Map<String, byte[]> getXAttrs(Path path) throws IOException {\n    throw new UnsupportedOperationException(getClass().getSimpleName()","sourceCodeStart":1378,"sourceCodeEnd":1414,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/AbstractFileSystem.java#L1378-L1414","documentation":"getXAttr(path, name) reads one extended attribute; AbstractFileSystem provides no base implementation, so filesystems without xattr support throw UnsupportedOperationException naming themselves. Only xattr-capable filesystems (HDFS with dfs.namenode.xattrs.enabled, POSIX-backed local filesystems) override it, and FileContext.getXAttr / 'hadoop fs -getfattr -n' hit the default elsewhere.","triggerScenarios":"fc.getXAttr(path, name) on S3A/ABFS/ftp/http stores; lookup of a tagging or lineage xattr on a defaultFS without xattr support; code that treats 'attribute missing' and 'xattrs unsupported' as the same case and only catches IOException.","commonSituations":"Metadata readers for frameworks that stamp user.* xattrs on HDFS, run in environments where some paths point at object stores; enrichment code that reads optional per-file hints; heterogeneous data lakes with mixed backends.","solutions":["Probe fc.hasPathCapability(path, CommonPathCapabilities.FS_XATTRS) before reading","Treat unsupported-xattr as 'no value': catch UnsupportedOperationException and apply the default, keeping HDFS behavior intact","Keep xattr names in the user.* namespace; other namespaces may be rejected even on HDFS"],"exampleFix":"// before\nbyte[] v = fc.getXAttr(path, \"user.lineage\"); // -> UOE on s3a://\n\n// after\nbyte[] v = null;\nif (fc.hasPathCapability(path, CommonPathCapabilities.FS_XATTRS)) {\n  v = fc.getXAttr(path, \"user.lineage\");\n} // else keep null default","handlingStrategy":"fallback","validationCode":"if (fc.hasPathCapability(path, CommonPathCapabilities.FS_XATTRS)) {\n  byte[] v = fc.getXAttr(path, name);\n}","typeGuard":"boolean xattrCapable(Path p) throws IOException {\n  return fc.hasPathCapability(p, CommonPathCapabilities.FS_XATTRS);\n}","tryCatchPattern":"try { return fc.getXAttr(path, name); } catch (UnsupportedOperationException e) { return DEFAULT_VALUE; } // unsupported store == attribute absent","preventionTips":["Conflate 'xattrs unsupported' with 'attribute absent' in lookup code so HDFS and object stores behave the same","Catch UnsupportedOperationException separately from IOException around optional metadata reads","Cache capability per store to avoid repeated probing in hot loops"],"tags":["xattr","extended-attributes","unsupported-feature","object-store","hadoop-fs"],"backgroundTag":"filesystem-capability-unsupported","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}