{"record":{"id":"a39055a7b29766fe","repo":"apache/hadoop","slug":"no-arguments-specified","errorCode":null,"errorMessage":"No arguments specified","messagePattern":"No arguments specified","errorType":"validation","errorClass":"HadoopIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/log/LogLevel.java","lineNumber":144,"sourceCode":"    private void sendLogLevelRequest()\n        throws HadoopIllegalArgumentException, Exception {\n      switch (operation) {\n      case GETLEVEL:\n        doGetLevel();\n        break;\n      case SETLEVEL:\n        doSetLevel();\n        break;\n      default:\n        throw new HadoopIllegalArgumentException(\n          \"Expect either -getlevel or -setlevel\");\n      }\n    }\n\n    public void parseArguments(String[] args) throws\n        HadoopIllegalArgumentException {\n      if (args.length == 0) {\n        throw new HadoopIllegalArgumentException(\"No arguments specified\");\n      }\n      int nextArgIndex = 0;\n      while (nextArgIndex < args.length) {\n        if (args[nextArgIndex].equals(\"-getlevel\")) {\n          nextArgIndex = parseGetLevelArgs(args, nextArgIndex);\n        } else if (args[nextArgIndex].equals(\"-setlevel\")) {\n          nextArgIndex = parseSetLevelArgs(args, nextArgIndex);\n        } else if (args[nextArgIndex].equals(\"-protocol\")) {\n          nextArgIndex = parseProtocolArgs(args, nextArgIndex);\n        } else {\n          throw new HadoopIllegalArgumentException(\n              \"Unexpected argument \" + args[nextArgIndex]);\n        }\n      }\n\n      // if operation is never specified in the arguments\n      if (operation == Operations.UNKNOWN) {\n        throw new HadoopIllegalArgumentException(","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/log/LogLevel.java#L126-L162","documentation":"LogLevel.CLI.parseArguments rejects an empty argument vector immediately: the log-level tool must be told what to do (-getlevel or -setlevel) and where (host:port, classname). HadoopIllegalArgumentException is thrown, run() prints usage, and the CLI exits with -1. No network activity happens — this is pure argument validation.","triggerScenarios":"Running 'hadoop loglevel' (or 'hadoop org.apache.hadoop.log.LogLevel') with zero arguments; invoking ToolRunner.run(new CLI(conf), new String[0]); a wrapper script that forwards an unset variable, e.g., $ARGS expanding to nothing.","commonSituations":"Shell scripts calling the tool with unquoted/unset variables; CI jobs constructing the command dynamically from empty input; users probing the tool's behavior with no args.","solutions":["Supply valid options, e.g. 'hadoop loglevel -getlevel namenode:9870 org.apache.hadoop.ipc.Server'.","Fix the wrapper script: default the args variable ('${ARGS:-}') and guard against empty expansion before invoking the tool.","Run 'hadoop loglevel' with no args intentionally to print usage when unsure of the syntax."],"exampleFix":"# before\nhadoop loglevel $EMPTY_VAR\n\n# after\nhadoop loglevel -getlevel namenode:9870 org.apache.hadoop.ipc.Server","handlingStrategy":"validation","validationCode":"// In wrappers: refuse to invoke the tool on empty input\nif (args == null || args.length == 0) {\n  System.err.println(LogLevel.USAGES);\n  return 1;\n}\nreturn ToolRunner.run(new LogLevel.CLI(conf), args);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Guard shell wrappers with ${VAR:-} checks so empty variables never produce a bare 'hadoop loglevel'.","Print usage (LogLevel.USAGES) whenever the arg array is empty.","Treat a zero-arg invocation as a usage request, not an error path, in automation."],"tags":["hadoop","logging","cli","loglevel","arguments"],"backgroundTag":"missing-cli-arguments","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}