apache/hadoop · error · ExitUtil.ExitException

42

42

Error message

No arguments provided

What it means

Thrown by the static entry point of the S3Guard CLI ('hadoop aws s3guard'). S3GuardTool.run(Configuration, String...) first strips Hadoop generic options (-conf, -D, ...) with GenericOptionsParser; if no arguments remain it prints the help text and throws ExitUtil.ExitException with exit code 42 (EXIT_USAGE) and message 'No arguments provided'. The class is only a command dispatcher, so it refuses to run without a subcommand.

Source

Thrown at hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/s3guard/S3GuardTool.java:969

  }

  /**
   * Execute the command with the given arguments.
   *
   * @param conf Hadoop configuration.
   * @param args command specific arguments.
   * @return exit code.
   * @throws Exception on I/O errors.
   */
  public static int run(Configuration conf, String... args) throws
      Exception {
    /* ToolRunner.run does this too, but we must do it before looking at
    subCommand or instantiating the cmd object below */
    String[] otherArgs = new GenericOptionsParser(conf, args)
        .getRemainingArgs();
    if (otherArgs.length == 0) {
      printHelp();
      throw new ExitUtil.ExitException(E_USAGE, "No arguments provided");
    }
    final String subCommand = otherArgs[0];
    LOG.debug("Executing command {}", subCommand);
    // if it is no longer supported: raise an exception
    if (UNSUPPORTED_COMMANDS.contains(subCommand)) {
      throw s3guardUnsupported();
    }
    switch (subCommand) {

    case BucketInfo.NAME:
      command = new BucketInfo(conf);
      break;
    case BucketTool.NAME:
      command = new BucketTool(conf);
      break;
    case MarkerTool.MARKERS:
      command = new MarkerTool(conf);
      break;

View on GitHub (pinned to 2add963021)

Solutions

  1. Rerun with a supported subcommand: bucket-info, bucket, markers or uploads (e.g. 'hadoop aws s3guard uploads s3a://bucket')
  2. If the subcommand comes from a variable, echo the full command line to find the unset/empty variable and fix the script
  3. Run 'hadoop aws s3guard' with no arguments deliberately to print the help and the exact command list
  4. If you were using an old S3Guard command (init, destroy, import, prune, diff, fsck, authoritative, set-capacity), it was removed with the DynamoDB metadata store - delete it from the workflow

Example fix

# before (CMD unset, expands to nothing)
hadoop aws s3guard "$CMD" s3a://logs
# after
hadoop aws s3guard uploads s3a://logs
Defensive patterns

Strategy: validation

Validate before calling

String[] remaining = new GenericOptionsParser(conf, args.clone()).getRemainingArgs();
if (remaining.length == 0) {
  System.err.println("s3guard: no subcommand supplied - aborting before tool launch");
  return EXIT_USAGE; // do not call S3GuardTool.run
}

Try / catch

try {
  int rc = S3GuardTool.run(conf, args);
} catch (ExitUtil.ExitException e) {
  if (e.getExitCode() == 42) {
    // usage error: print help and fix the invoking command line
  }
}

Prevention

When it happens

Trigger: Running 'hadoop aws s3guard' with zero arguments; supplying only generic options such as 's3guard -D fs.s3a.endpoint=s3.amazonaws.com' so nothing remains after parsing; calling S3GuardTool.run(conf) programmatically with empty varargs; a shell script in which the subcommand variable expands to an empty string.

Common situations: Upgrading from Hadoop 3.2/3.3 where s3guard had many subcommands that no longer exist; CI scripts that assemble the command line dynamically and end up passing an empty command; copy-pasted documentation examples that omit the subcommand.

Related errors


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/daf53a60b0ddfbe3. Report an issue: GitHub.