{"record":{"id":"0b8e0baf78d65f45","repo":"apache/hadoop","slug":"doesn-t-support-getxattrs-0b8e0b","errorCode":null,"errorMessage":"{} doesn't support getXAttrs","messagePattern":"(.+?) doesn't support getXAttrs","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java","lineNumber":3304,"sourceCode":"    throw new UnsupportedOperationException(getClass().getSimpleName()\n        + \" doesn't support getXAttr\");\n  }\n\n  /**\n   * Get all of the xattr name/value pairs for a file or directory.\n   * Only those xattrs 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   * @return Map describing the XAttrs of the file or directory\n   * @throws IOException IO failure\n   * @throws UnsupportedOperationException if the operation is unsupported\n   *         (default outcome).\n   */\n  public Map<String, byte[]> getXAttrs(Path path) throws IOException {\n    throw new UnsupportedOperationException(getClass().getSimpleName()\n        + \" doesn't support getXAttrs\");\n  }\n\n  /**\n   * Get all of the xattrs name/value pairs for a file or directory.\n   * Only those xattrs 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   * @param names XAttr names.\n   * @return Map describing the XAttrs of the file or directory\n   * @throws IOException IO failure\n   * @throws UnsupportedOperationException if the operation is unsupported\n   *         (default outcome).\n   */\n  public Map<String, byte[]> getXAttrs(Path path, List<String> names)","sourceCodeStart":3286,"sourceCodeEnd":3322,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java#L3286-L3322","documentation":"FileSystem.getXAttrs(Path) (read ALL xattr name/value pairs for a path) is optional; the base class throws UnsupportedOperationException with getClass().getSimpleName() + \" doesn't support getXAttrs\". Only HDFS-family clients and pass-through wrappers implement bulk xattr reads; local filesystem and S3A/GCS-style connectors throw.","triggerScenarios":"Calling fs.getXAttrs(path) on file://, s3a://, gs://, har:// or a custom FileSystem; 'dump all attributes' utilities, metadata crawlers, or distcp -p xattr preservation enumerating attributes on every path.","commonSituations":"Metadata harvest for governance/search crawling mixed data lakes; replication tooling that preserves xattrs and hits a non-HDFS destination or source.","solutions":["Probe fs.hasPathCapability(path, CommonPathCapabilities.FS_XATTRS) before the bulk read","Return an empty map for non-supporting stores instead of failing the crawl","distcp: disable xattr preservation (-p without xattr) when either endpoint lacks support","Keep attribute data in an external catalog keyed by path for non-HDFS stores"],"exampleFix":"// before\nMap<String, byte[]> all = fs.getXAttrs(path); // throws on LocalFileSystem\n\n// after\nMap<String, byte[]> all = fs.hasPathCapability(path,\n        CommonPathCapabilities.FS_XATTRS)\n    ? fs.getXAttrs(path)\n    : Collections.emptyMap();","handlingStrategy":"try-catch","validationCode":"Map<String, byte[]> xattrs = fs.hasPathCapability(path,\n        CommonPathCapabilities.FS_XATTRS)\n    ? fs.getXAttrs(path)\n    : Collections.emptyMap();","typeGuard":"static boolean supportsBulkXattrRead(FileSystem fs) {\n  return fs instanceof DistributedFileSystem\n      || fs instanceof WebHdfsFileSystem;\n}","tryCatchPattern":"try {\n  return fs.getXAttrs(path);\n} catch (UnsupportedOperationException e) {\n  return Collections.emptyMap(); // crawler-friendly default for xattr-less stores\n}","preventionTips":["Crawlers: return empty maps for non-supporting stores instead of aborting","Batch-probe capability per filesystem root once, not per file","For replication tools, disable xattr preservation when either endpoint lacks FS_XATTRS"],"tags":["hadoop","filesystem","hdfs","xattr","unsupportedoperationexception","metadata","crawler"],"backgroundTag":"filesystem-xattr-unsupported","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}