{"record":{"id":"daf53a60b0ddfbe3","repo":"apache/hadoop","slug":"42","errorCode":"42","errorMessage":"No arguments provided","messagePattern":"No arguments provided","errorType":"exception","errorClass":"ExitUtil.ExitException","httpStatus":null,"severity":"error","filePath":"hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/s3guard/S3GuardTool.java","lineNumber":969,"sourceCode":"  }\n\n  /**\n   * Execute the command with the given arguments.\n   *\n   * @param conf Hadoop configuration.\n   * @param args command specific arguments.\n   * @return exit code.\n   * @throws Exception on I/O errors.\n   */\n  public static int run(Configuration conf, String... args) throws\n      Exception {\n    /* ToolRunner.run does this too, but we must do it before looking at\n    subCommand or instantiating the cmd object below */\n    String[] otherArgs = new GenericOptionsParser(conf, args)\n        .getRemainingArgs();\n    if (otherArgs.length == 0) {\n      printHelp();\n      throw new ExitUtil.ExitException(E_USAGE, \"No arguments provided\");\n    }\n    final String subCommand = otherArgs[0];\n    LOG.debug(\"Executing command {}\", subCommand);\n    // if it is no longer supported: raise an exception\n    if (UNSUPPORTED_COMMANDS.contains(subCommand)) {\n      throw s3guardUnsupported();\n    }\n    switch (subCommand) {\n\n    case BucketInfo.NAME:\n      command = new BucketInfo(conf);\n      break;\n    case BucketTool.NAME:\n      command = new BucketTool(conf);\n      break;\n    case MarkerTool.MARKERS:\n      command = new MarkerTool(conf);\n      break;","sourceCodeStart":951,"sourceCodeEnd":987,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/s3guard/S3GuardTool.java#L951-L987","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Rerun with a supported subcommand: bucket-info, bucket, markers or uploads (e.g. 'hadoop aws s3guard uploads s3a://bucket')","If the subcommand comes from a variable, echo the full command line to find the unset/empty variable and fix the script","Run 'hadoop aws s3guard' with no arguments deliberately to print the help and the exact command list","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"],"exampleFix":"# before (CMD unset, expands to nothing)\nhadoop aws s3guard \"$CMD\" s3a://logs\n# after\nhadoop aws s3guard uploads s3a://logs","handlingStrategy":"validation","validationCode":"String[] remaining = new GenericOptionsParser(conf, args.clone()).getRemainingArgs();\nif (remaining.length == 0) {\n  System.err.println(\"s3guard: no subcommand supplied - aborting before tool launch\");\n  return EXIT_USAGE; // do not call S3GuardTool.run\n}","typeGuard":null,"tryCatchPattern":"try {\n  int rc = S3GuardTool.run(conf, args);\n} catch (ExitUtil.ExitException e) {\n  if (e.getExitCode() == 42) {\n    // usage error: print help and fix the invoking command line\n  }\n}","preventionTips":["Never build the s3guard command from a possibly-empty variable; assert it first","In shell wrappers add '[ -n \"$SUBCMD\" ] || { echo \"missing subcommand\" >&2; exit 2; }'","Pin the subcommand list to the Hadoop version in use: bucket-info, bucket, markers, uploads"],"tags":["cli","usage","s3a","s3guard","hadoop-aws","exit-code-42"],"backgroundTag":"missing-cli-argument","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}