apache/hadoop · error · UnsupportedOperationException

Not supported

Error message

Not supported

What it means

DelegationClient implements the TOS SDK's TOSV2 interface to wrap the real client with delegation/session-token refresh and retries. The raw putObject(bucket, objectKey, InputStream, RequestOptionsBuilder...) overload is intentionally unimplemented and throws UnsupportedOperationException("Not supported"). Writes are expected to go through the connector's helper put(bucket, key, InputStreamProvider, contentLength, acl) or uploadFile(bucket, UploadFileInput), which are implemented.

Source

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

      RequestOptionsBuilder... builders) throws TosException {
    return retry(() -> client.deleteObject(bucket, objectKey, builders));
  }

  @Override
  public DeleteMultiObjectsOutput deleteMultiObjects(
      String bucket,
      DeleteMultiObjectsInput input,
      RequestOptionsBuilder... builders)
      throws TosException {
    return retry(() -> client.deleteMultiObjects(bucket, input, builders));
  }

  @Override
  public PutObjectOutput putObject(
      String bucket, String objectKey, InputStream inputStream,
      RequestOptionsBuilder... builders)
      throws TosException {
    throw new UnsupportedOperationException("Not supported");
  }

  @Override
  public UploadFileOutput uploadFile(
      String bucket, UploadFileInput input,
      RequestOptionsBuilder... builders) throws TosException {
    return retry(() -> client.uploadFile(bucket, input, builders));
  }

  @Override
  public AppendObjectOutput appendObject(
      String bucket, String objectKey, InputStream content, long offset,
      RequestOptionsBuilder... builders)
      throws TosException {
    throw new UnsupportedOperationException("Not supported");
  }

  @Override

View on GitHub (pinned to 2add963021)

Solutions

  1. Use DelegationClient.put(bucket, key, InputStreamProvider, contentLength, acl) or uploadFile(bucket, UploadFileInput), which are supported
  2. Write through the connector's normal path (FSDataOutputStream on tos://) instead of raw client calls
  3. For ad-hoc putObject calls, build a separate plain TOSV2 client with explicit credentials

Example fix

// before
client.putObject(bucket, key, inputStream, builders);

// after
client.put(bucket, key, () -> inputStream, contentLength, ACLType.ACL_PRIVATE);
// or
client.uploadFile(bucket, uploadFileInput);
Defensive patterns

Strategy: validation

Validate before calling

if (client instanceof DelegationClient) {
  client.put(bucket, key, () -> inputStream, contentLength, ACLType.ACL_PRIVATE);
} else {
  client.putObject(bucket, key, inputStream);
}

Type guard

private static boolean isDelegationClient(TOSV2 client) {
  return client instanceof org.apache.hadoop.fs.tosfs.object.tos.DelegationClient;
}

Try / catch

try {
  client.putObject(bucket, key, inputStream);
} catch (UnsupportedOperationException e) {
  // route to the supported write path
  client.put(bucket, key, () -> inputStream, contentLength, ACLType.ACL_PRIVATE);
}

Prevention

When it happens

Trigger: Custom code that obtains the TOSV2 client (e.g. via DelegationClientBuilder) and calls client.putObject(bucket, key, inputStream) directly; SDK example code ported unchanged from a plain TOSV2 client to a delegation-token deployment.

Common situations: Applications reaching into connector internals for side writes; STS/delegation-token environments where code was originally written against a directly built client.

Related errors


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