apache/hadoop · error · UnsupportedOperationException
{} is not supported
Error message
{} is not supported What it means
Default branch of the PUT-typed WebHDFS switch on the NameNode (put(), which serves CREATE, MKDIRS, RENAME, SETOWNER, SETSTORAGEPOLICY, SETQUOTA, ALLOWSNAPSHOT, etc.). The op query parameter parsed to a valid Op constant, but that operation is served by another HTTP verb (GET, POST, or DELETE), so the switch falls through to UnsupportedOperationException('<OP> is not supported') — note the doubled space comes from the string concatenation in the source. The client sees an HTTP 400 RemoteException.
Source
Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/web/resources/NamenodeWebHdfsMethods.java:973
cp.disableErasureCodingPolicy(ecpolicy.getValue());
return Response.ok().type(MediaType.APPLICATION_OCTET_STREAM).build();
case SETECPOLICY:
validateOpParams(op, ecpolicy);
cp.setErasureCodingPolicy(fullpath, ecpolicy.getValue());
return Response.ok().type(MediaType.APPLICATION_OCTET_STREAM).build();
case SETQUOTA:
validateOpParams(op, namespaceQuota, storagespaceQuota);
cp.setQuota(fullpath, namespaceQuota.getValue(),
storagespaceQuota.getValue(), null);
return Response.ok().type(MediaType.APPLICATION_OCTET_STREAM).build();
case SETQUOTABYSTORAGETYPE:
validateOpParams(op, storagespaceQuota, storageType);
cp.setQuota(fullpath, HdfsConstants.QUOTA_DONT_SET,
storagespaceQuota.getValue(),
StorageType.parseStorageType(storageType.getValue()));
return Response.ok().type(MediaType.APPLICATION_OCTET_STREAM).build();
default:
throw new UnsupportedOperationException(op + " is not supported");
}
}
/**
* Handle HTTP POST request for the root.
*
* @param ugi User and group information for Hadoop.
* @param delegation Represents delegation token used for authentication.
* @param username User parameter.
* @param doAsUser DoAs parameter for proxy user.
* @param op Http POST operation parameter.
* @param concatSrcs The concat source paths parameter.
* @param bufferSize Buffer size parameter.
* @param excludeDatanodes Exclude datanodes param.
* @param newLength NewLength parameter.
* @param noredirect Overwrite parameter.
* @return Represents an HTTP response.
* @throws IOException any IOE raised, or translated exception.View on GitHub (pinned to 2add963021)
Solutions
- Check the op in the WebHDFS REST API documentation table and use the HTTP method it lists (GETFILESTATUS->GET, DELETE->DELETE, SETSTORAGEPOLICY->PUT)
- Fix the client to select the verb from an op-to-method map instead of hardcoding it
- Reproduce with curl using the documented verb to confirm the cluster is fine
- If a gateway sits in the path, verify it forwards the original method unchanged
Example fix
# before: GET-only op sent as PUT curl -X PUT "http://nn:9870/webhdfs/v1/data/f?op=GETFILESTATUS" # 400 ... UnsupportedOperationException: GETFILESTATUS is not supported # after curl "http://nn:9870/webhdfs/v1/data/f?op=GETFILESTATUS"
Defensive patterns
Strategy: validation
Validate before calling
private static final Map<String, String> OP_TO_VERB = Map.of(
"GETFILESTATUS", "GET", "LISTSTATUS", "GET", "OPEN", "GET",
"MKDIRS", "PUT", "SETSTORAGEPOLICY", "PUT", "RENAME", "PUT",
"CONCAT", "POST", "UNSETSTORAGEPOLICY", "POST",
"DELETE", "DELETE", "DELETESNAPSHOT", "DELETE");
static String verbFor(String op) {
String verb = OP_TO_VERB.get(op.toUpperCase(Locale.ROOT));
if (verb == null) throw new IllegalArgumentException("unknown WebHDFS op: " + op);
return verb;
} Type guard
static final Set<String> PUT_OPS = Set.of("CREATE", "MKDIRS", "RENAME", "SETREPLICATION",
"SETOWNER", "SETPERMISSION", "SETTIMES", "SETSTORAGEPOLICY", "SETQUOTA", "SETQUOTABYSTORAGETYPE");
static boolean isPutOp(String op) {
return PUT_OPS.contains(op.toUpperCase(Locale.ROOT));
} Try / catch
catch (IOException e) { // RemoteException: java.lang.UnsupportedOperationException
if (e.getMessage() != null && e.getMessage().endsWith("is not supported")) {
// op/verb mismatch: re-dispatch with the verb from the op-to-method table
} else throw e;
} Prevention
- Drive HTTP verb selection from a per-op table, never hardcode one verb
- Keep the table beside a contract test that exercises one op per verb against a mini-cluster
- Confirm gateways in the path forward methods unchanged
When it happens
Trigger: Issuing a WebHDFS operation with the wrong verb: curl -X PUT '...?op=GETFILESTATUS' (GET-only), curl -X PUT '...?op=DELETE' (DELETE-only), or curl -X PUT '...?op=CONCAT' (POST-only). Also clients that hardcode one verb for all operations and HTTP gateways that rewrite methods.
Common situations: REST clients generated from a template that fixes the verb; scripts written against older WebHDFS docs where an op moved between methods; curl muscle-memory using -X PUT for every state change; proxies converting verbs (POST-to-PUT rewrites).
Related errors
- {} is not supported
- {} is not supported
- Storage policy name is empty.
- File does not exist: {}
- {} parameter is not null.
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/ac6edd60001b864f.
Report an issue: GitHub.