{"record":{"id":"6954f9e3939ff5a8","repo":"apache/hadoop","slug":"attribute-with-name-is-not-found","errorCode":null,"errorMessage":"Attribute with name {} is not found.","messagePattern":"Attribute with name (.+?) is 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":721,"sourceCode":"    if (getFileStatus(path).isDirectory()) {\n      return new HashMap<>();\n    } else {\n      Path qualifiedPath = path.makeQualified(uri, workingDir);\n      String key = ObjectUtils.pathToKey(qualifiedPath);\n\n      Map<String, String> tags = storage.getTags(key);\n      return tags.entrySet().stream()\n          .collect(Collectors.toMap(Map.Entry::getKey, t -> Bytes.toBytes(t.getValue())));\n    }\n  }\n\n  @Override\n  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 {","sourceCodeStart":703,"sourceCodeEnd":739,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-cloud-storage-project/hadoop-tos/src/main/java/org/apache/hadoop/fs/tosfs/RawFileSystem.java#L703-L739","documentation":"getXAttr(path, name) throws IOException when the requested extended attribute is absent, because xattrs in RawFileSystem are backed by TOS object tags and the single-attribute getter has no 'missing means null' mode. HDFS exhibits the same behavior for unknown xattr names.","triggerScenarios":"fs.getXAttr(path, \"user.env\") when no tag with that key exists on the object; name not prefixed correctly for the tag namespace the connector maps xattrs onto.","commonSituations":"Metadata readers probing optional annotations; tags deleted out-of-band or never written because the writing job's setXAttr failed; name typos or prefix differences ('user.' vs raw tag key).","solutions":["Fetch all attributes and look up defensively: fs.getXAttrs(path).get(name), handling null","Verify the tag actually exists in the TOS console / via storage.getTags before reading","Confirm the exact xattr-to-tag name mapping the connector uses before probing"],"exampleFix":"// before\nbyte[] v = fs.getXAttr(path, \"user.env\"); // IOException when tag absent\n\n// after\nMap<String, byte[]> all = fs.getXAttrs(path);\nbyte[] v = all.get(\"user.env\"); // null when absent\nif (v != null) { ... }","handlingStrategy":"validation","validationCode":"Map<String, byte[]> all = fs.getXAttrs(path);\nbyte[] v = all.get(name); // null when the tag is absent -- no exception","typeGuard":null,"tryCatchPattern":"try { v = fs.getXAttr(path, name); }\ncatch (IOException e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"is not found\")) { v = null; }\n  else throw e;\n}","preventionTips":["Prefer getXAttrs(path) + map lookup over the single-name getter","Confirm the xattr/tag name mapping before probing","Treat missing tags as absent metadata, not corruption"],"tags":["xattr","missing-attribute","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"}