{"record":{"id":"3e7f12bd377dbbe3","repo":"apache/hadoop","slug":"42-3e7f12","errorCode":"42","errorMessage":"Wrong number of arguments: %d","messagePattern":"Wrong number of arguments: (.+?)","errorType":"error_code","errorClass":"ExitUtil.ExitException","httpStatus":null,"severity":"error","filePath":"hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/tools/MarkerTool.java","lineNumber":240,"sourceCode":"\n  @Override\n  public void resetBindings() {\n    super.resetBindings();\n    storeContext = null;\n    operations = null;\n  }\n\n  @Override\n  public int run(final String[] args, final PrintStream stream)\n      throws ExitUtil.ExitException, Exception {\n    this.out = stream;\n    final List<String> parsedArgs = parseArgsWithErrorReporting(args);\n    if (parsedArgs.size() != 1) {\n      errorln(getUsage());\n      println(out, \"Supplied arguments: [\"\n          + String.join(\", \", parsedArgs)\n          + \"]\");\n      throw new ExitUtil.ExitException(EXIT_USAGE,\n          String.format(E_ARGUMENTS, parsedArgs.size()));\n    }\n    // read arguments\n    CommandFormat command = getCommandFormat();\n    verbose = command.getOpt(VERBOSE);\n\n    // minimum number of markers expected\n    int expectedMin = getOptValue(OPT_MIN, 0);\n    // max number of markers allowed\n    int expectedMax = getOptValue(OPT_MAX, 0);\n\n\n    // determine the action\n    boolean audit = command.getOpt(OPT_AUDIT);\n    boolean clean = command.getOpt(OPT_CLEAN);\n    if (audit == clean) {\n      // either both are set or neither are set\n      // this is equivalent to (not audit xor clean)","sourceCodeStart":222,"sourceCodeEnd":258,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/tools/MarkerTool.java#L222-L258","documentation":"The markers tool requires exactly one non-option argument: the path to scan. run() checks parsedArgs.size() != 1, prints the usage plus the supplied argument list, and throws ExitUtil.ExitException EXIT_USAGE (42) with 'Wrong number of arguments: <count>' (constant E_ARGUMENTS).","triggerScenarios":"'markers -audit' with no path; two or more non-option tokens (e.g. 'markers -audit s3a://a s3a://b'); a value-taking option (-min, -max, -limit, -out) given without its value so the next token is consumed or a stray token survives.","commonSituations":"Forgetting the path; wrappers appending extra arguments; options whose value was accidentally dropped during script refactoring.","solutions":["Supply exactly one path: 'hadoop aws s3guard markers -audit s3a://bucket/path'","Re-check that every value-taking option (-min, -max, -limit, -out) is followed by its value so token counting works out","Read the tool's own output - it prints the supplied arguments list, which shows exactly which stray or missing token caused the count mismatch"],"exampleFix":"# before\nhadoop aws s3guard markers -audit\n# after\nhadoop aws s3guard markers -audit s3a://my-bucket/tables","handlingStrategy":"validation","validationCode":"List<String> nonOption = extractNonOptionArgs(args); // same rules as CommandFormat\nif (nonOption.size() != 1) {\n  System.err.println(\"markers requires exactly one path, got \" + nonOption.size());\n  return 42;\n}","typeGuard":null,"tryCatchPattern":"try {\n  int rc = new MarkerTool(conf).exec(args);\n} catch (ExitUtil.ExitException e) {\n  if (e.getMessage().startsWith(\"Wrong number of arguments\")) {\n    // re-print usage and the parsed argument list, then correct the invocation\n  }\n}","preventionTips":["Wrap the tool and assert exactly one path argument before delegating","Remember value-taking options consume the following token - miscounted values shift the path position"],"tags":["cli","usage","s3a","directory-markers","exit-code-42"],"backgroundTag":"cli-argument-count-mismatch","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}