{"record":{"id":"3394f036215b7aba","repo":"apache/hadoop","slug":"invalid-http-get-operation-0","errorCode":null,"errorMessage":"Invalid HTTP GET operation [{0}]","messagePattern":"Invalid HTTP GET operation \\[(.+?)\\]","errorType":"exception","errorClass":"IOException","httpStatus":500,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/server/HttpFSServer.java","lineNumber":594,"sourceCode":"      response = Response.ok(js).type(MediaType.APPLICATION_JSON).build();\n      break;\n    }\n    case GETSTATUS: {\n      FSOperations.FSStatus command = new FSOperations.FSStatus(path);\n      @SuppressWarnings(\"rawtypes\") Map js = fsExecute(user, command);\n      response = Response.ok(js).type(MediaType.APPLICATION_JSON).build();\n      break;\n    }\n    case GETTRASHROOTS: {\n      Boolean allUsers = params.get(AllUsersParam.NAME, AllUsersParam.class);\n      FSOperations.FSGetTrashRoots command = new FSOperations.FSGetTrashRoots(allUsers);\n      Map json = fsExecute(user, command);\n      AUDIT_LOG.info(\"allUsers [{}]\", allUsers);\n      response = Response.ok(json).type(MediaType.APPLICATION_JSON).build();\n      break;\n    }\n    default: {\n      throw new IOException(\n          MessageFormat.format(\"Invalid HTTP GET operation [{0}]\", op.value()));\n    }\n    }\n    return response;\n  }\n\n  /**\n   * Create an open redirection URL from a request. It points to the same\n   * HttpFS endpoint but removes the \"redirect\" parameter.\n   * @param uriInfo uri info of the request.\n   * @return URL for the redirected location.\n   */\n  private URI createOpenRedirectionURL(UriInfo uriInfo) {\n    UriBuilder uriBuilder = uriInfo.getRequestUriBuilder();\n    uriBuilder.replaceQueryParam(NoRedirectParam.NAME, (Object[])null);\n    return uriBuilder.build((Object[])null);\n  }\n","sourceCodeStart":576,"sourceCodeEnd":612,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/server/HttpFSServer.java#L576-L612","documentation":"HttpFSServer.get() dispatches on the op parameter over the operations valid for HTTP GET and falls into the default branch, throwing IOException('Invalid HTTP GET operation [<op>]') for anything else. This is HttpFS's client-facing 'verb/operation mismatch' signal — the op name may be valid HDFS but not for GET, or not valid at all for this server version.","triggerScenarios":"GET ?op=MKDIRS (MKDIRS is a PUT op); GET ?op=SETREPLICATION (a PUT op); a typo like op=GETFILESTATUSE; using an operation added in a newer Hadoop release against an older HttpFS server (e.g. GETECCODECS on an HttpFS from an earlier branch); hand-rolled clients defaulting every call to GET.","commonSituations":"Porting REST scripts between WebHDFS gateway implementations with slightly different op sets; version skew between hadoop-client and the HttpFS server after a rolling upgrade; curl examples copied with the wrong verb; tools like wget that only do GET.","solutions":["Check the WebHDFS/HttpFS REST spec for the operation and re-issue with the correct HTTP verb (MKDIRS/RENAME/SETPERMISSION... -> PUT; APPEND -> POST; DELETE -> DELETE; opens/lists -> GET).","Verify the op spelling exactly (case-sensitive) against the operation enum of the server's Hadoop version.","If the op simply does not exist on this server, upgrade HttpFS to the Hadoop version whose client you use."],"exampleFix":"# before\n$ curl 'http://host:14000/webhdfs/v1/tmp/dir?op=MKDIRS&user.name=alice&permissions=755'\n\n# after\n$ curl -X PUT 'http://host:14000/webhdfs/v1/tmp/dir?op=MKDIRS&user.name=alice&permissions=755'","handlingStrategy":"validation","validationCode":"Set<String> GET_OPS = Set.of(\"OPEN\",\"GETFILESTATUS\",\"LISTSTATUS\",\"GETCONTENTSUMMARY\",\n    \"GETFILECHECKSUM\",\"GETHOMEDIRECTORY\",\"GETTRASHROOT\",\"GETTRASHROOTS\",\n    \"GETACLSTATUS\",\"LISTXATTRS\",\"GETXATTRS\",\"CHECKACCESS\",\"GETALLSTORAGEPOLICY\",\n    \"GETSTORAGEPOLICY\",\"GETSNAPSHOTLIST\",\"GETSNAPSHOTTABLEDIRECTORYLIST\",\n    \"GETFILEBLOCKLOCATIONS\",\"GETECCODECS\",\"GETErasureCodingPolicy\".toUpperCase(),\n    \"INSTRUMENTATION\",\"STATUS\");\nif (!GET_OPS.contains(op)) throw new IllegalArgumentException(op + \" is not a GET operation\");","typeGuard":"static boolean isValidGetOp(String op) {\n  return Set.of(\"OPEN\",\"LISTSTATUS\",\"GETFILESTATUS\",\"GETFILECHECKSUM\",\n    \"GETCONTENTSUMMARY\",\"GETHOMEDIRECTORY\",\"GETTRASHROOT\",\"GETTRASHROOTS\",\n    \"GETACLSTATUS\",\"GETXATTRS\",\"LISTXATTRS\",\"CHECKACCESS\",\"GETSTORAGEPOLICY\",\n    \"GETALLSTORAGEPOLICY\",\"GETSNAPSHOTLIST\",\"GETSNAPSHOTTABLEDIRECTORYLIST\",\n    \"GETFILEBLOCKLOCATIONS\",\"GETECCODECS\",\"INSTRUMENTATION\").contains(op);\n}","tryCatchPattern":"try {\n  resp = http.get(buildUrl(op));\n} catch (IOException e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"Invalid HTTP GET operation\")) {\n    throw new IllegalArgumentException(\"Wrong verb or typo for op \" + op, e);\n  }\n  throw e;\n}","preventionTips":["Drive requests from an op-to-verb table copied from the WebHDFS REST spec for your Hadoop version.","Pin client and server Hadoop versions during rolling upgrades.","Smoke-test every op your automation uses after server upgrades."],"tags":["httpfs","webhdfs","rest-api","http-get","operation-dispatch","bad-request"],"backgroundTag":"invalid-operation-param","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}