{"record":{"id":"9bc453c100e44084","repo":"apache/hadoop","slug":"doesn-t-support-setxattr","errorCode":null,"errorMessage":"{} doesn't support setXAttr","messagePattern":"(.+?) doesn't support setXAttr","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/AbstractFileSystem.java","lineNumber":1379,"sourceCode":"        XAttrSetFlag.REPLACE));\n  }\n\n  /**\n   * Set an xattr of 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 modify\n   * @param name xattr name.\n   * @param value xattr value.\n   * @param flag xattr set flag\n   * @throws IOException raised on errors performing I/O.\n   */\n  public void setXAttr(Path path, String name, byte[] value,\n      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\");","sourceCodeStart":1361,"sourceCodeEnd":1397,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/AbstractFileSystem.java#L1361-L1397","documentation":"setXAttr is an opt-in extended-attribute operation: the base AbstractFileSystem throws UnsupportedOperationException with the filesystem's simple class name, and only filesystems that persist xattrs override it (HDFS with dfs.namenode.xattrs.enabled, some local/POSIX-backed filesystems). FileContext.setXAttr and 'hadoop fs -setfattr -n' reach this default on stores without xattr support.","triggerScenarios":"fc.setXAttr(path, name, value, flag) on an object store, ftp, or http filesystem; frameworks stamping metadata (tagging, lineage markers) via xattrs uniformly across all configured stores; 'hadoop fs -setfattr' against a defaultFS without xattr support.","commonSituations":"Metadata tagging frameworks written for HDFS deployed onto S3-compatible storage; lineage/tracking tools that store job attributes as xattrs; tests running against LocalFs on filesystems without user xattr support.","solutions":["Probe fc.hasPathCapability(path, CommonPathCapabilities.FS_XATTRS) before writing xattrs","Store the metadata in an alternative carrier (sidecar file, manifest, object metadata) when the store lacks xattrs","On HDFS verify dfs.namenode.xattrs.enabled=true and use only permitted namespaces (user.*; raw./security./trusted. are restricted)"],"exampleFix":"// before\nfc.setXAttr(path, \"user.lineage\", value, EnumSet.of(XAttrSetFlag.CREATE));\n\n// after\nif (fc.hasPathCapability(path, CommonPathCapabilities.FS_XATTRS)) {\n  fc.setXAttr(path, \"user.lineage\", value, EnumSet.of(XAttrSetFlag.CREATE));\n} else {\n  writeSidecarMetadata(path, value);\n}","handlingStrategy":"validation","validationCode":"if (fc.hasPathCapability(path, CommonPathCapabilities.FS_XATTRS)) {\n  fc.setXAttr(path, name, value, EnumSet.of(XAttrSetFlag.CREATE));\n} else {\n  writeSidecarMetadata(path, value);\n}","typeGuard":"boolean xattrCapable(Path p) throws IOException {\n  return fc.hasPathCapability(p, CommonPathCapabilities.FS_XATTRS);\n}","tryCatchPattern":"try { fc.setXAttr(path, name, value, flag); } catch (UnsupportedOperationException e) { /* persist metadata via sidecar file / object metadata instead */ }","preventionTips":["Probe fs.capability.paths.xattrs before stamping metadata on files","Design metadata carriers that degrade to sidecar files on stores without xattrs","Use only user.* names on HDFS; raw./security./trusted. namespaces are restricted"],"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-23T01:17:44.959Z"}