apache/hadoop · error · UnsupportedOperationException

%s doesn't support putObjectTagging.

Error message

%s doesn't support putObjectTagging.

What it means

ObjectStorage is the storage SPI of hadoop-tos. putTags has a default implementation that throws UnsupportedOperationException("<ClassName> doesn't support putObjectTagging."). Only the real TOS backend overrides it (TOS.putTags), so calling putTags on the local FileStore backend or on any custom ObjectStorage implementation that did not override the default fails with this error.

Source

Thrown at hadoop-cloud-storage-project/hadoop-tos/src/main/java/org/apache/hadoop/fs/tosfs/object/ObjectStorage.java:324

   * Will overwrite dest object if dest object exists.
   *
   * @param srcKey source object key
   * @param dstKey dest object key
   * @throws RuntimeException if rename failed,e.g. srcKey is equal to dstKey or the source object
   *                          doesn't exist.
   */
  void rename(String srcKey, String dstKey);

  /**
   * Attach tags to specified object. This method will overwrite all existed tags with the new tags.
   * Remove all existed tags if the new tags are empty. The maximum tags number is 10.
   *
   * @param key     the key of the object key.
   * @param newTags the new tags to put.
   * @throws RuntimeException if key doesn't exist.
   */
  default void putTags(String key, Map<String, String> newTags) {
    throw new UnsupportedOperationException(
        this.getClass().getSimpleName() + " doesn't support putObjectTagging.");
  }

  /**
   * Get all attached tags of the object.
   *
   * @param key the key of the object.
   * @return map containing all tags.
   * @throws RuntimeException if key doesn't exist.
   */
  default Map<String, String> getTags(String key) {
    throw new UnsupportedOperationException(
        this.getClass().getSimpleName() + " doesn't support getObjectTagging.");
  }

  /**
   * Gets the object status for the given key.
   * It's different from {@link ObjectStorage#head(String)}, it returns object info if the key

View on GitHub (pinned to 2add963021)

Solutions

  1. Use the real TOS object storage (tos:// URI with bucket credentials) when object tagging is required
  2. Guard the call with a capability check (instanceof TOS, or an explicit supportsTags flag) before invoking putTags
  3. Override putTags/getTags in custom ObjectStorage implementations if the backing store supports tagging

Example fix

// before
storage.putTags(key, tags);

// after
if (storage instanceof TOS) {
  storage.putTags(key, tags);
} else {
  LOG.warn("Object tagging unsupported by {}", storage.getClass().getSimpleName());
}
Defensive patterns

Strategy: type-guard

Type guard

private static boolean supportsTagging(ObjectStorage storage) {
  return storage instanceof org.apache.hadoop.fs.tosfs.object.tos.TOS;
}

Try / catch

try {
  storage.putTags(key, tags);
} catch (UnsupportedOperationException e) {
  LOG.warn("Tagging unsupported by {}: {}", storage.getClass().getSimpleName(), e.getMessage());
}

Prevention

When it happens

Trigger: Calling ObjectStorage.putTags(key, tags) on a FileStore instance (local/test backend) or on a custom ObjectStorage plugin that lacks an override, e.g. while exercising tagging logic in unit tests or against a file-based store.

Common situations: Running connector tests on the file-based backend that exercise tagging; writing a custom ObjectStorage implementation and forgetting to implement putTags/getTags.

Related errors


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