{"record":{"id":"5ae0a237004eda14","repo":"apache/hadoop","slug":"is-not-supported-5ae0a2","errorCode":null,"errorMessage":"{} is not supported","messagePattern":"(.+?) is not supported","errorType":"http","errorClass":"UnsupportedOperationException","httpStatus":400,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/web/resources/NamenodeWebHdfsMethods.java","lineNumber":1137,"sourceCode":"    }\n    case TRUNCATE:\n    {\n      validateOpParams(op, newLength);\n      // We treat each rest request as a separate client.\n      final boolean b = cp.truncate(fullpath, newLength.getValue(),\n          \"DFSClient_\" + DFSUtil.getSecureRandom().nextLong());\n      final String js = JsonUtil.toJsonString(\"boolean\", b);\n      return Response.ok(js).type(MediaType.APPLICATION_JSON).build();\n    }\n    case UNSETSTORAGEPOLICY: {\n      cp.unsetStoragePolicy(fullpath);\n      return Response.ok().build();\n    }\n    case UNSETECPOLICY:\n      cp.unsetErasureCodingPolicy(fullpath);\n      return Response.ok().build();\n    default:\n      throw new UnsupportedOperationException(op + \" is not supported\");\n    }\n  }\n\n  /**\n   * Handle HTTP GET request for the root.\n   *\n   * @param ugi User and group information for Hadoop.\n   * @param uriInfo An injectable interface that provides access.\n   * to application and request URI information.\n   * @param delegation Represents delegation token used for authentication.\n   * @param username User parameter.\n   * @param doAsUser DoAs parameter for proxy user.\n   * @param op Http GET operation parameter.\n   * @param offset Offset parameter.\n   * @param length Length parameter.\n   * @param renewer Renewer parameter.\n   * @param bufferSize Buffer size parameter.\n   * @param xattrNames XAttr Name parameter.","sourceCodeStart":1119,"sourceCodeEnd":1155,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/web/resources/NamenodeWebHdfsMethods.java#L1119-L1155","documentation":"Default branch of the POST-typed WebHDFS switch on the NameNode (post(), which serves APPEND data, CONCAT, TRUNCATE, CREATESNAPSHOT, RENAMESNAPSHOT, UNSETSTORAGEPOLICY, UNSETECPOLICY, ...). The op parsed to a valid Op constant but belongs to PUT, GET, or DELETE, so the handler throws UnsupportedOperationException('<OP> is not supported') and the client receives HTTP 400.","triggerScenarios":"POSTing an operation owned by another verb: curl -X POST '...?op=SETSTORAGEPOLICY' (PUT-only), '...?op=GETFILESTATUS' (GET-only), '...?op=DELETE' (DELETE-only). Also generic clients that always POST because 'POST works for everything'.","commonSituations":"Wrappers that tunnel every operation through POST; code copied from an example for a different op; ops renamed or re-homed between Hadoop releases; HTML-form-based tools that can only issue GET/POST.","solutions":["Match the verb to the op per the WebHDFS REST table (UNSETSTORAGEPOLICY/UNSECECPOLICY-type ops are POST; SETSTORAGEPOLICY is PUT)","Drive verb selection from a per-op map in the client","Test one representative op per verb against the cluster to validate the client's dispatch table"],"exampleFix":"# before: PUT-only op sent as POST\ncurl -X POST \"http://nn:9870/webhdfs/v1/data?op=UNSETSTORAGEPOLICY&user.name=hdfs\"\n# -> fine (UNSETSTORAGEPOLICY is POST); but:\ncurl -X POST \"http://nn:9870/webhdfs/v1/data?op=SETSTORAGEPOLICY&storagepolicy=WARM\"\n# 400 ... SETSTORAGEPOLICY is not supported\n\n# after\ncurl -X PUT \"http://nn:9870/webhdfs/v1/data?op=SETSTORAGEPOLICY&storagepolicy=WARM&user.name=hdfs\"","handlingStrategy":"validation","validationCode":"static final Set<String> POST_OPS = Set.of(\"APPEND\", \"CONCAT\", \"TRUNCATE\", \"CREATESNAPSHOT\",\n    \"RENAMESNAPSHOT\", \"UNSETSTORAGEPOLICY\", \"UNSETECPOLICY\", \"SETXATTR\", \"REMOVEXATTR\");\n\nstatic void requirePost(String op) {\n  if (!POST_OPS.contains(op.toUpperCase(Locale.ROOT))) {\n    throw new IllegalArgumentException(op + \" is not a POST operation; check the WebHDFS verb table\");\n  }\n}","typeGuard":"static boolean isPostOp(String op) {\n  return POST_OPS.contains(op.toUpperCase(Locale.ROOT));\n}","tryCatchPattern":"catch (IOException e) {\n  if (e.getMessage() != null && e.getMessage().endsWith(\"is not supported\")) {\n    throw new IllegalStateException(\"verb/verb mismatch sending \" + op + \" via POST\", e);\n  }\n  throw e;\n}","preventionTips":["Never tunnel all mutations through POST; dispatch by op-to-verb map","Pin the WebHDFS documentation version your client was written against","Add an integration test per verb so dispatch regressions surface in CI"],"tags":["webhdfs","hdfs","rest-api","http-method","unsupported-operation","post"],"backgroundTag":"http-method-mismatch","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}