{"record":{"id":"b56191aeaf9edf1c","repo":"apache/hadoop","slug":"doesn-t-support-removexattr","errorCode":null,"errorMessage":"{} doesn't support removeXAttr","messagePattern":"(.+?) doesn't support removeXAttr","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/AbstractFileSystem.java","lineNumber":1467,"sourceCode":"  public List<String> listXAttrs(Path path)\n          throws IOException {\n    throw new UnsupportedOperationException(getClass().getSimpleName()\n            + \" doesn't support listXAttrs\");\n  }\n\n  /**\n   * Remove 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 remove extended attribute\n   * @param name xattr name\n   * @throws IOException raised on errors performing I/O.\n   */\n  public void removeXAttr(Path path, String name) throws IOException {\n    throw new UnsupportedOperationException(getClass().getSimpleName()\n        + \" doesn't support removeXAttr\");\n  }\n\n  /**\n   * The specification of this method matches that of\n   * {@link FileContext#createSnapshot(Path, String)}.\n   *\n   * @param path the path.\n   * @param snapshotName snapshot name.\n   * @throws IOException raised on errors performing I/O.\n   * @return path.\n   */\n  public Path createSnapshot(final Path path, final String snapshotName)\n      throws IOException {\n    throw new UnsupportedOperationException(getClass().getSimpleName()\n        + \" doesn't support createSnapshot\");\n  }\n","sourceCodeStart":1449,"sourceCodeEnd":1485,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/AbstractFileSystem.java#L1449-L1485","documentation":"AbstractFileSystem.removeXAttr(Path, String) is a default stub that unconditionally throws UnsupportedOperationException, prefixed with the concrete subclass name. Removing extended attributes is optional API surface; only filesystems that implement xattrs (HDFS, WebHDFS) override it. The error therefore reports that the filesystem mounted for the URI has no xattr support, not that the attribute is missing (that case throws NoXAttrSetException on HDFS instead).","triggerScenarios":"Calling FileContext.removeXAttr(path, \"user.foo\") (or the equivalent shell path `hadoop fs -removexattr`) against s3a/gs/wasb/ftp schemes or a local backend without the override. Cleanup code that strips user.* attributes on job completion fails when the path is on an unsupported store.","commonSituations":"Jobs migrated from HDFS to object stores keep attribute-cleanup logic; config changes (fs.defaultFS, viewfs mount table) point cleanup paths at non-HDFS targets; tests run against local FS hit the stub.","solutions":["Check the class name in the message and the path's URI scheme; removeXAttr only works on hdfs:// and webhdfs://.","Skip or gate cleanup logic by scheme so it only runs where xattrs exist.","Catch UnsupportedOperationException and treat removal as a no-op when the feature is optional.","Verify you actually have an xattr to remove: on HDFS a missing attribute is a different exception (NoXAttrSetException), so a UOE here always means unsupported scheme."],"exampleFix":"// before\nfc.removeXAttr(path, \"user.lineage\"); // throws on unsupported scheme\n\n// after\ntry {\n  fc.removeXAttr(path, \"user.lineage\");\n} catch (UnsupportedOperationException e) {\n  // no xattr support on this filesystem: nothing to remove\n}","handlingStrategy":"try-catch","validationCode":"static boolean supportsXAttrRemove(FileContext fc, Path probe) {\n  try {\n    fc.listXAttrs(probe);\n    return true;\n  } catch (UnsupportedOperationException e) {\n    return false;\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  fc.removeXAttr(path, name);\n} catch (UnsupportedOperationException e) {\n  // no xattr engine on this filesystem: nothing to remove\n}","preventionTips":["Run xattr cleanup only on schemes where setXAttr succeeded earlier","Track which paths ever had xattrs set instead of blanket-removing everywhere","Treat UnsupportedOperationException as control flow, not a failure to log at ERROR"],"tags":["hadoop","filesystem","xattr","filecontext","unsupportedoperationexception"],"backgroundTag":"xattr-unsupported","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}