{"record":{"id":"1d4cf6f28dad99f2","repo":"apache/hadoop","slug":"uri-is-not-specified","errorCode":null,"errorMessage":"-uri is not specified.","messagePattern":"-uri is not specified\\.","errorType":"validation","errorClass":"HdfsCompatIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-tools/hadoop-compat-bench/src/main/java/org/apache/hadoop/fs/compat/HdfsCompatTool.java","lineNumber":157,"sourceCode":"  private boolean isHelp(String[] args) {\n    if ((args == null) || (args.length == 0)) {\n      return true;\n    }\n    return (args.length == 1) && (args[0].equalsIgnoreCase(\"-h\") ||\n        args[0].equalsIgnoreCase(\"--help\"));\n  }\n\n  private void parseArgs(String[] args) {\n    CommandFormat cf = new CommandFormat(0, Integer.MAX_VALUE);\n    cf.addOptionWithValue(\"uri\");\n    cf.addOptionWithValue(\"suite\");\n    cf.addOptionWithValue(\"output\");\n    cf.parse(args, 0);\n    this.uri = cf.getOptValue(\"uri\");\n    this.suite = cf.getOptValue(\"suite\");\n    this.output = cf.getOptValue(\"output\");\n    if (isEmpty(this.uri)) {\n      throw new HdfsCompatIllegalArgumentException(\"-uri is not specified.\");\n    }\n    if (isEmpty(this.suite)) {\n      this.suite = \"ALL\";\n    }\n  }\n\n  private boolean isEmpty(final String value) {\n    return (value == null) || value.isEmpty();\n  }\n\n  private void printError(String message) {\n    err.println(message);\n  }\n\n  private void printOut(String message) {\n    out.println(message);\n  }\n","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-tools/hadoop-compat-bench/src/main/java/org/apache/hadoop/fs/compat/HdfsCompatTool.java#L139-L175","documentation":"HdfsCompatTool (the hadoop-compat-bench CLI) parses -uri, -suite and -output via CommandFormat; the filesystem under test comes only from the -uri value. parseArgs throws HdfsCompatIllegalArgumentException('-uri is not specified.') when the -uri option is absent or its value is empty. -suite is optional and defaults to ALL; -uri is not optional.","triggerScenarios":"Running the compat tool without the -uri flag (e.g. 'HdfsCompatTool -suite ls'), passing -uri \"\" (empty value), or positioning the URI so CommandFormat.parse treats it as a positional argument instead of the option value.","commonSituations":"Doc examples that omit -uri; wrapper scripts that build the command from a variable and silently drop the flag when the variable is empty; confusion between -uri and a positional path argument.","solutions":["Pass an explicit filesystem URI: hadoop ... HdfsCompatTool -uri hdfs://namenode:8020/ -suite <suite> [-output <path>]","If the URI comes from a variable, guard the wrapper script so the command is not built when the variable is unset or empty","Confirm the URI scheme is the one you intend to test (hdfs://, webhdfs://, abfs://, ...)"],"exampleFix":"# before\nhadoop jar compat-bench.jar org.apache.hadoop.fs.compat.HdfsCompatTool -suite ls\n# -> -uri is not specified.\n\n# after\nhadoop jar compat-bench.jar org.apache.hadoop.fs.compat.HdfsCompatTool \\\n  -uri hdfs://nn.example.com:8020/ -suite ls -output hdfs://nn/compat-out","handlingStrategy":"validation","validationCode":"#!/usr/bin/env bash\n# fail fast in wrapper scripts before the JVM starts\n: \"${COMPAT_URI:?-uri is required, e.g. hdfs://nn:8020/}\"\nhadoop jar compat-bench.jar org.apache.hadoop.fs.compat.HdfsCompatTool \\\n  -uri \"$COMPAT_URI\" -suite \"${COMPAT_SUITE:-ALL}\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat -uri as mandatory in wrapper scripts and print usage when it is missing or empty","Validate the URI parses and has a scheme: new Path(uri).toUri().getScheme() != null","Keep one canonical example command with -uri in project docs so examples never omit it"],"tags":["hadoop-compat-bench","cli","command-line-arguments","uri"],"backgroundTag":"missing-command-line-option","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}