apache/hadoop · error · RuntimeException
{err}
Error message
{err} What it means
SimulatedDataNodes.printUsageExit() prints the offending message, prints the USAGE text, then rethrows the message as a RuntimeException, terminating the tool. The main producer is run(): 'Not enough arguments' when fewer than 2 command line args are given. The message text you see is whatever err was passed in.
Source
Thrown at hadoop-tools/hadoop-dynamometer/hadoop-dynamometer-infra/src/main/java/org/apache/hadoop/tools/dynamometer/SimulatedDataNodes.java:83
*/
public class SimulatedDataNodes extends Configured implements Tool {
// Set this arbitrarily large (100TB) since we don't care about storage
// capacity
private static final long STORAGE_CAPACITY = 100 * 2L << 40;
private static final String USAGE = "Usage: "
+ "org.apache.hadoop.tools.dynamometer.SimulatedDataNodes "
+ "bpid blockListFile1 [ blockListFileN ... ]\n"
+ " bpid should be the ID of the block pool to which these DataNodes "
+ "belong.\n"
+ " Each blockListFile specified should contain a list of blocks to "
+ "be served by one DataNode.\n"
+ " See the Javadoc of this class for more detail.";
static void printUsageExit(String err) {
System.out.println(err);
System.out.println(USAGE);
throw new RuntimeException(err);
}
public static void main(String[] args) throws Exception {
SimulatedDataNodes datanodes = new SimulatedDataNodes();
ToolRunner.run(new HdfsConfiguration(), datanodes, args);
}
public int run(String[] args) throws Exception {
if (args.length < 2) {
printUsageExit("Not enough arguments");
}
String bpid = args[0];
List<Path> blockListFiles = new ArrayList<>();
for (int i = 1; i < args.length; i++) {
blockListFiles.add(new Path(args[i]));
}
URI defaultFS = FileSystem.getDefaultUri(getConf());View on GitHub (pinned to 2add963021)
Solutions
- Invoke as: hadoop jar ... SimulatedDataNodes <bpid> <blockListFile1> [blockListFile2 ...]
- Verify globs for the block list files expand to at least one existing file before the call
- Check that a preceding option parser is not swallowing the positional arguments
Example fix
# before SimulatedDataNodes bp-123 # after: bpid plus at least one block list file SimulatedDataNodes bp-123 /tmp/blocks/dn0.out /tmp/blocks/dn1.out
Defensive patterns
Strategy: validation
Validate before calling
if (args.length < 2) {
System.err.println("usage: SimulatedDataNodes <bpid> <blockListFile...>");
System.exit(2);
} Prevention
- Wrap the tool in a script that checks arg count and file existence first
- Use 'set -u' in bash so unset variables/globs fail early
When it happens
Trigger: Launching org.apache.hadoop.tools.dynamometer.SimulatedDataNodes with 0 or 1 arguments. The tool requires args[0] = block pool id (bpid) and args[1..N] = block listing files, one per simulated DataNode, so args.length < 2 always lands here.
Common situations: Forgetting the bpid in a wrapper script, or a shell glob for the block list files expanding to zero files so only the bpid survives.
Related errors
- "Unexpected argument " + args[nextArgIndex]
- Bad argument: {}
- Expect either -getlevel or -setlevel
- No arguments specified
- Must specify either -getlevel or -setlevel
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/d79acb158a98c7d2.
Report an issue: GitHub.