{"record":{"id":"d5b4973c3be0bb6c","repo":"apache/hadoop","slug":"attributes-with-name-are-not-found","errorCode":null,"errorMessage":"Attributes with name {} are not found.","messagePattern":"Attributes with name (.+?) are not found\\.","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-cloud-storage-project/hadoop-tos/src/main/java/org/apache/hadoop/fs/tosfs/RawFileSystem.java","lineNumber":734,"sourceCode":"  public byte[] getXAttr(Path path, String name) throws IOException {\n    Map<String, byte[]> xAttrs = getXAttrs(path);\n    if (xAttrs.containsKey(name)) {\n      return xAttrs.get(name);\n    } else {\n      throw new IOException(\"Attribute with name \" + name + \" is not found.\");\n    }\n  }\n\n  @Override\n  public Map<String, byte[]> getXAttrs(Path path, List<String> names) throws IOException {\n    Map<String, byte[]> xAttrs = getXAttrs(path);\n    xAttrs.keySet().retainAll(names);\n    if (xAttrs.size() == names.size()) {\n      return xAttrs;\n    } else {\n      List<String> badNames = names.stream().filter(n -> !xAttrs.containsKey(n)).collect(\n          Collectors.toList());\n      throw new IOException(\"Attributes with name \" + badNames + \" are not found.\");\n    }\n  }\n\n  @Override\n  public List<String> listXAttrs(Path path) throws IOException {\n    return Lists.newArrayList(getXAttrs(path).keySet());\n  }\n\n  @Override\n  public void removeXAttr(Path path, String name) throws IOException {\n    if (getFileStatus(path).isFile()) {\n      Path qualifiedPath = path.makeQualified(uri, workingDir);\n      String key = ObjectUtils.pathToKey(qualifiedPath);\n\n      Map<String, String> existedTags = storage.getTags(key);\n      if (existedTags.remove(name) != null) {\n        storage.putTags(key, existedTags);\n      }","sourceCodeStart":716,"sourceCodeEnd":752,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-cloud-storage-project/hadoop-tos/src/main/java/org/apache/hadoop/fs/tosfs/RawFileSystem.java#L716-L752","documentation":"getXAttrs(path, names) throws IOException listing the missing names when the retained result is smaller than the requested list: the batch getter requires every requested xattr (object tag) to exist and reports badNames (the difference) in the message.","triggerScenarios":"fs.getXAttrs(path, Arrays.asList(\"user.a\", \"user.b\")) when at least one of the tags is absent; xAttrs.keySet().retainAll(names) drops the missing ones and the size comparison fails.","commonSituations":"Bulk metadata reads where some objects carry only a subset of tags; schema evolution adding new tags that older objects lack; mixing mandatory and optional attributes in one request.","solutions":["Request attributes individually or use getXAttrs(path) and filter, treating absent keys as missing","Backfill the missing tags on objects that should carry them","Split required vs optional names: batch-get required, individually probe optional"],"exampleFix":"// before\nMap<String, byte[]> m = fs.getXAttrs(path, Arrays.asList(\"user.a\", \"user.b\")); // throws if either missing\n\n// after\nMap<String, byte[]> m = fs.getXAttrs(path);\nfor (String want : new String[]{\"user.a\", \"user.b\"}) {\n  byte[] v = m.get(want); // null when absent\n}","handlingStrategy":"validation","validationCode":"Map<String, byte[]> all = fs.getXAttrs(path);\nfor (String n : wantedNames) {\n  byte[] v = all.get(n); // tolerate absence per-attribute\n}","typeGuard":null,"tryCatchPattern":"try { m = fs.getXAttrs(path, names); }\ncatch (IOException e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"are not found\")) {\n    // message lists badNames: fall back to per-name gets or backfill tags\n  } else throw e;\n}","preventionTips":["Batch-get only attributes guaranteed to exist","Backfill new tags during schema evolution before batch reads","Split required vs optional attribute requests"],"tags":["xattr","missing-attribute","batch-read","object-tags","tos"],"backgroundTag":"xattr-not-found","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}