{"record":{"id":"cce7c3a6ba38a541","repo":"apache/hadoop","slug":"incorrect-number-of-arguments","errorCode":null,"errorMessage":"Incorrect number of arguments.","messagePattern":"Incorrect number of arguments\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/SnapshotCommands.java","lineNumber":112,"sourceCode":"  public static class DeleteSnapshot extends FsCommand {\n    public static final String NAME = DELETE_SNAPSHOT;\n    public static final String USAGE = \"<snapshotDir> <snapshotName>\";\n    public static final String DESCRIPTION = \n        \"Delete a snapshot from a directory\";\n\n    private String snapshotName;\n\n    @Override\n    protected void processPath(PathData item) throws IOException {\n      if (!item.stat.isDirectory()) {\n        throw new PathIsNotDirectoryException(item.toString());\n      }\n    }\n\n    @Override\n    protected void processOptions(LinkedList<String> args) throws IOException {\n      if (args.size() != 2) {\n        throw new IllegalArgumentException(\"Incorrect number of arguments.\");\n      }\n      snapshotName = args.removeLast();\n    }\n\n    @Override\n    protected void processArguments(LinkedList<PathData> items)\n        throws IOException {\n      super.processArguments(items);\n      if (numErrors != 0) { // check for error collecting paths\n        return;\n      }\n      assert (items.size() == 1);\n      PathData sroot = items.getFirst();\n      sroot.fs.deleteSnapshot(sroot.path, snapshotName);\n      out.println(\"Deleted snapshot \" + snapshotName + \" under \" + sroot.path);\n    }\n  }\n  ","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/SnapshotCommands.java#L94-L130","documentation":"Error \"Incorrect number of arguments.\" thrown in apache/hadoop.","triggerScenarios":"Thrown by snapshot shell commands (e.g. renameSnapshot) when the number of positional arguments does not match what the command requires.","commonSituations":"See trigger scenarios.","solutions":["Supply the exact number of arguments required by the snapshot command; check the command usage.","Remove extra arguments or add the missing <snapshotDir>/<snapshotName> arguments."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}