{"record":{"id":"77f86e9bc8b1feae","repo":"apache/hadoop","slug":"illegal-argument-arg","errorCode":null,"errorMessage":"Illegal argument: ${arg}","messagePattern":"Illegal argument: (.+?)","errorType":"validation","errorClass":"HadoopIllegalArgumentException","httpStatus":null,"severity":"warning","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/BootstrapStandby.java","lineNumber":144,"sourceCode":"          return doRun();\n        } catch (IOException e) {\n          throw new RuntimeException(e);\n        }\n      }\n    });\n  }\n  \n  private void parseArgs(String[] args) {\n    for (String arg : args) {\n      if (\"-force\".equals(arg)) {\n        force = true;\n      } else if (\"-nonInteractive\".equals(arg)) {\n        interactive = false;\n      } else if (\"-skipSharedEditsCheck\".equals(arg)) {\n        skipSharedEditsCheck = true;\n      } else {\n        printUsage();\n        throw new HadoopIllegalArgumentException(\n            \"Illegal argument: \" + arg);\n      }\n    }\n  }\n\n  private void printUsage() {\n    System.out.println(\"Usage: \" + this.getClass().getSimpleName() +\n        \" [-force] [-nonInteractive] [-skipSharedEditsCheck]\\n\"\n        + \"\\t-force: formats if the name directory exists.\\n\"\n        + \"\\t-nonInteractive: formats aborts if the name directory exists,\\n\"\n        + \"\\tunless -force option is specified.\\n\"\n        + \"\\t-skipSharedEditsCheck: skips edits check which ensures that\\n\"\n        + \"\\twe have enough edits already in the shared directory to start\\n\"\n        + \"\\tup from the last checkpoint on the active.\");\n  }\n\n  private NamenodeProtocol createNNProtocolProxy(InetSocketAddress otherIpcAddr)\n      throws IOException {","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/BootstrapStandby.java#L126-L162","documentation":"BootstrapStandby.parseArgs() accepts exactly -force, -nonInteractive and -skipSharedEditsCheck; any other token prints usage and throws HadoopIllegalArgumentException('Illegal argument: <arg>'). It is a pure command-line usage error for 'hdfs namenode -bootstrapStandby'.","triggerScenarios":"Running 'hdfs namenode -bootstrapStandby <anything-else>' — a typo like -forces or -noniteractive, a flag belonging to another subcommand (-format, -rollUpgrade), or a stray argument after the subcommand.","commonSituations":"Operators copy a flag from another namenode subcommand; shell scripts pass unquoted variables that expand to unexpected tokens; documentation from a different Hadoop version mentions a flag that does not exist here.","solutions":["Re-run with only supported flags: hdfs namenode -bootstrapStandby [-force] [-nonInteractive] [-skipSharedEditsCheck]","Check for typos and shell expansion in the failing argument (echo the command before running)","Run 'hdfs namenode -help' for this release's actual flag list"],"exampleFix":"# before\n$ hdfs namenode -bootstrapStandby -forceFormats\nIllegal argument: -forceFormats\n# after\n$ hdfs namenode -bootstrapStandby -force","handlingStrategy":"validation","validationCode":"Set<String> allowed = Set.of(\"-force\", \"-nonInteractive\", \"-skipSharedEditsCheck\");\nfor (String arg : args) {\n  if (!allowed.contains(arg)) {\n    System.err.println(\"Usage: hdfs namenode -bootstrapStandby [-force] \"\n        + \"[-nonInteractive] [-skipSharedEditsCheck]\");\n    System.exit(1); // fail fast with usage instead of deep exception\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  BootstrapStandby runner = new BootstrapStandby(conf, ...);\n} catch (HadoopIllegalArgumentException e) { // \"Illegal argument: X\"\n  // pure usage error: print usage, exit non-zero; no retry needed\n}","preventionTips":["Quote variables in automation scripts and echo the full command before executing","Check 'hdfs namenode -help' for this release when reusing commands from other Hadoop versions"],"tags":["hdfs","namenode","bootstrap-standby","cli","invalid-argument","usage"],"backgroundTag":"invalid-cli-argument","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}