apache/hadoop · error · IOException

Attribute with name {} is not found.

Error message

Attribute with name {} is not found.

What it means

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.

Source

Thrown at hadoop-cloud-storage-project/hadoop-tos/src/main/java/org/apache/hadoop/fs/tosfs/RawFileSystem.java:721

    if (getFileStatus(path).isDirectory()) {
      return new HashMap<>();
    } else {
      Path qualifiedPath = path.makeQualified(uri, workingDir);
      String key = ObjectUtils.pathToKey(qualifiedPath);

      Map<String, String> tags = storage.getTags(key);
      return tags.entrySet().stream()
          .collect(Collectors.toMap(Map.Entry::getKey, t -> Bytes.toBytes(t.getValue())));
    }
  }

  @Override
  public byte[] getXAttr(Path path, String name) throws IOException {
    Map<String, byte[]> xAttrs = getXAttrs(path);
    if (xAttrs.containsKey(name)) {
      return xAttrs.get(name);
    } else {
      throw new IOException("Attribute with name " + name + " is not found.");
    }
  }

  @Override
  public Map<String, byte[]> getXAttrs(Path path, List<String> names) throws IOException {
    Map<String, byte[]> xAttrs = getXAttrs(path);
    xAttrs.keySet().retainAll(names);
    if (xAttrs.size() == names.size()) {
      return xAttrs;
    } else {
      List<String> badNames = names.stream().filter(n -> !xAttrs.containsKey(n)).collect(
          Collectors.toList());
      throw new IOException("Attributes with name " + badNames + " are not found.");
    }
  }

  @Override
  public List<String> listXAttrs(Path path) throws IOException {

View on GitHub (pinned to 2add963021)

Solutions

  1. Fetch all attributes and look up defensively: fs.getXAttrs(path).get(name), handling null
  2. Verify the tag actually exists in the TOS console / via storage.getTags before reading
  3. Confirm the exact xattr-to-tag name mapping the connector uses before probing

Example fix

// before
byte[] v = fs.getXAttr(path, "user.env"); // IOException when tag absent

// after
Map<String, byte[]> all = fs.getXAttrs(path);
byte[] v = all.get("user.env"); // null when absent
if (v != null) { ... }
Defensive patterns

Strategy: validation

Validate before calling

Map<String, byte[]> all = fs.getXAttrs(path);
byte[] v = all.get(name); // null when the tag is absent -- no exception

Try / catch

try { v = fs.getXAttr(path, name); }
catch (IOException e) {
  if (e.getMessage() != null && e.getMessage().contains("is not found")) { v = null; }
  else throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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).

Related errors


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/6954f9e3939ff5a8. Report an issue: GitHub.