{"record":{"id":"c3cbcd1bab46e08f","repo":"apache/hadoop","slug":"missing-operation-parameter-0","errorCode":null,"errorMessage":"Missing Operation parameter [{0}]","messagePattern":"Missing Operation parameter \\[(.+?)\\]","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":400,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/wsrs/ParametersProvider.java","lineNumber":68,"sourceCode":"    try {\n      return paramClass.newInstance();\n    } catch (Exception ex) {\n      throw new UnsupportedOperationException(\n        MessageFormat.format(\"Param class [{0}] does not have default constructor\",\n            paramClass.getName()));\n    }\n  }\n\n  public Parameters get(HttpServletRequest request) {\n    Map<String, List<Param<?>>> map = new HashMap<>();\n\n    Map<String, String[]> queryString = request.getParameterMap();\n    String str = null;\n    if(queryString.containsKey(driverParam)) {\n      str = queryString.get(driverParam)[0];\n    }\n    if (str == null) {\n      throw new IllegalArgumentException(\n        MessageFormat.format(\"Missing Operation parameter [{0}]\",\n                             driverParam));\n    }\n    Enum op;\n    try {\n      op = Enum.valueOf(enumClass, StringUtils.toUpperCase(str));\n    } catch (IllegalArgumentException ex) {\n      throw new IllegalArgumentException(\n        MessageFormat.format(\"Invalid Operation [{0}]\", str));\n    }\n    if (!paramsDef.containsKey(op)) {\n      throw new IllegalArgumentException(\n        MessageFormat.format(\"Unsupported Operation [{0}]\", op));\n    }\n    for (Class<Param<?>> paramClass : paramsDef.get(op)) {\n      Param<?> param = newParam(paramClass);\n      List<Param<?>> paramList = Lists.newArrayList();\n      String[] ps = queryString.get(param.getName());","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/wsrs/ParametersProvider.java#L50-L86","documentation":"ParametersProvider.get (ParametersProvider.java:68) requires every request to carry the driver query parameter — in HttpFS this is op (HttpFSFileSystem.OP_PARAM = \"op\"). If request.getParameterMap() contains no 'op' entry, it throws IllegalArgumentException(\"Missing Operation parameter [op]\"), which the WebHDFS endpoint surfaces as HTTP 400.","triggerScenarios":"A request to the httpfs WebHDFS endpoint without an op query component, e.g. curl 'http://host:14000/webhdfs/v1/user?user.name=hdfs'. Also caused by clients whose URL template drops the query string, or proxies/gateways that strip it.","commonSituations":"Hand-crafted or copy-pasted URLs missing op; a load balancer or rewrite rule dropping query strings; a client library bug after upgrading the WebHDFS URL builder; monitoring probes hitting the API root like a static page.","solutions":["Add the op query parameter with a valid operation name, e.g. &op=GETFILESTATUS.","Verify the complete URL (including query string) survives every proxy/gateway hop.","Fix or upgrade the client URL builder that omits op.","Point liveness probes at a non-WebHDFS endpoint (e.g. /jmx) instead of the WebHDFS API root."],"exampleFix":"# before\ncurl 'http://nn:14000/webhdfs/v1/user?user.name=hdfs'                 # 400 Missing Operation parameter [op]\n\n# after\ncurl 'http://nn:14000/webhdfs/v1/user?op=GETFILESTATUS&user.name=hdfs' # 200","handlingStrategy":"validation","validationCode":"String q = uri.getQuery();\nif (q == null || !java.util.Arrays.stream(q.split(\"&\")).anyMatch(p -> p.startsWith(\"op=\"))) {\n  throw new IllegalArgumentException(\"WebHDFS URL missing required 'op' parameter: \" + uri);\n}","typeGuard":null,"tryCatchPattern":"// server side: register a JAX-RS ExceptionMapper\n@Provider\npublic class IllegalArgumentMapper implements ExceptionMapper<IllegalArgumentException> {\n  public Response toResponse(IllegalArgumentException ex) {\n    return Response.status(Response.Status.BAD_REQUEST).entity(ex.getMessage()).build();\n  }\n}","preventionTips":["Centralize WebHDFS URL building in one client class that always appends op.","Integration-test every operation endpoint end to end.","Watch for gateways/proxies that drop query strings."],"tags":["java","hadoop","httpfs","rest","webhdfs","query-string"],"backgroundTag":"missing-required-parameter","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}