apache/hadoop · error · IllegalArgumentException
Missing Operation parameter [{0}]
Error message
Missing Operation parameter [{0}] What it means
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.
Source
Thrown at hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/wsrs/ParametersProvider.java:68
try {
return paramClass.newInstance();
} catch (Exception ex) {
throw new UnsupportedOperationException(
MessageFormat.format("Param class [{0}] does not have default constructor",
paramClass.getName()));
}
}
public Parameters get(HttpServletRequest request) {
Map<String, List<Param<?>>> map = new HashMap<>();
Map<String, String[]> queryString = request.getParameterMap();
String str = null;
if(queryString.containsKey(driverParam)) {
str = queryString.get(driverParam)[0];
}
if (str == null) {
throw new IllegalArgumentException(
MessageFormat.format("Missing Operation parameter [{0}]",
driverParam));
}
Enum op;
try {
op = Enum.valueOf(enumClass, StringUtils.toUpperCase(str));
} catch (IllegalArgumentException ex) {
throw new IllegalArgumentException(
MessageFormat.format("Invalid Operation [{0}]", str));
}
if (!paramsDef.containsKey(op)) {
throw new IllegalArgumentException(
MessageFormat.format("Unsupported Operation [{0}]", op));
}
for (Class<Param<?>> paramClass : paramsDef.get(op)) {
Param<?> param = newParam(paramClass);
List<Param<?>> paramList = Lists.newArrayList();
String[] ps = queryString.get(param.getName());View on GitHub (pinned to 2add963021)
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.
Example fix
# before curl 'http://nn:14000/webhdfs/v1/user?user.name=hdfs' # 400 Missing Operation parameter [op] # after curl 'http://nn:14000/webhdfs/v1/user?op=GETFILESTATUS&user.name=hdfs' # 200
Defensive patterns
Strategy: validation
Validate before calling
String q = uri.getQuery();
if (q == null || !java.util.Arrays.stream(q.split("&")).anyMatch(p -> p.startsWith("op="))) {
throw new IllegalArgumentException("WebHDFS URL missing required 'op' parameter: " + uri);
} Try / catch
// server side: register a JAX-RS ExceptionMapper
@Provider
public class IllegalArgumentMapper implements ExceptionMapper<IllegalArgumentException> {
public Response toResponse(IllegalArgumentException ex) {
return Response.status(Response.Status.BAD_REQUEST).entity(ex.getMessage()).build();
}
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.
Related errors
- Invalid value [{0}], must be a boolean
- Parameter [{0}], invalid value [{1}], value must be [{2}]
- Invalid Operation [{0}]
- Parameter [{0}], invalid value [{1}], value must be [{2}]
- The length to read ${length} exceeds the file length ${fin.l
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/c3cbcd1bab46e08f.
Report an issue: GitHub.