apache/hadoop · error · HdfsCompatIllegalArgumentException
-uri is not specified.
Error message
-uri is not specified.
What it means
HdfsCompatTool (the hadoop-compat-bench CLI) parses -uri, -suite and -output via CommandFormat; the filesystem under test comes only from the -uri value. parseArgs throws HdfsCompatIllegalArgumentException('-uri is not specified.') when the -uri option is absent or its value is empty. -suite is optional and defaults to ALL; -uri is not optional.
Source
Thrown at hadoop-tools/hadoop-compat-bench/src/main/java/org/apache/hadoop/fs/compat/HdfsCompatTool.java:157
private boolean isHelp(String[] args) {
if ((args == null) || (args.length == 0)) {
return true;
}
return (args.length == 1) && (args[0].equalsIgnoreCase("-h") ||
args[0].equalsIgnoreCase("--help"));
}
private void parseArgs(String[] args) {
CommandFormat cf = new CommandFormat(0, Integer.MAX_VALUE);
cf.addOptionWithValue("uri");
cf.addOptionWithValue("suite");
cf.addOptionWithValue("output");
cf.parse(args, 0);
this.uri = cf.getOptValue("uri");
this.suite = cf.getOptValue("suite");
this.output = cf.getOptValue("output");
if (isEmpty(this.uri)) {
throw new HdfsCompatIllegalArgumentException("-uri is not specified.");
}
if (isEmpty(this.suite)) {
this.suite = "ALL";
}
}
private boolean isEmpty(final String value) {
return (value == null) || value.isEmpty();
}
private void printError(String message) {
err.println(message);
}
private void printOut(String message) {
out.println(message);
}
View on GitHub (pinned to 2add963021)
Solutions
- Pass an explicit filesystem URI: hadoop ... HdfsCompatTool -uri hdfs://namenode:8020/ -suite <suite> [-output <path>]
- If the URI comes from a variable, guard the wrapper script so the command is not built when the variable is unset or empty
- Confirm the URI scheme is the one you intend to test (hdfs://, webhdfs://, abfs://, ...)
Example fix
# before hadoop jar compat-bench.jar org.apache.hadoop.fs.compat.HdfsCompatTool -suite ls # -> -uri is not specified. # after hadoop jar compat-bench.jar org.apache.hadoop.fs.compat.HdfsCompatTool \ -uri hdfs://nn.example.com:8020/ -suite ls -output hdfs://nn/compat-out
Defensive patterns
Strategy: validation
Validate before calling
#!/usr/bin/env bash
# fail fast in wrapper scripts before the JVM starts
: "${COMPAT_URI:?-uri is required, e.g. hdfs://nn:8020/}"
hadoop jar compat-bench.jar org.apache.hadoop.fs.compat.HdfsCompatTool \
-uri "$COMPAT_URI" -suite "${COMPAT_SUITE:-ALL}" Prevention
- Treat -uri as mandatory in wrapper scripts and print usage when it is missing or empty
- Validate the URI parses and has a scheme: new Path(uri).toUri().getScheme() != null
- Keep one canonical example command with -uri in project docs so examples never omit it
When it happens
Trigger: Running the compat tool without the -uri flag (e.g. 'HdfsCompatTool -suite ls'), passing -uri "" (empty value), or positioning the URI so CommandFormat.parse treats it as a positional argument instead of the option value.
Common situations: Doc examples that omit -uri; wrapper scripts that build the command from a variable and silently drop the flag when the variable is empty; confusion between -uri and a positional path argument.
Related errors
- GCS path supports only '%s' scheme, instead got '%s' from '%
- GCS bucket name cannot be empty.
- Invalid GCS bucket name '%s': bucket name must contain only
- GCS path must include non-empty object name [objectName='%s'
- Bad configuration of hadoop.security.key.provider.path at ${
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/1d4cf6f28dad99f2.
Report an issue: GitHub.