{"record":{"id":"768dbb1e44e8fcff","repo":"apache/druid","slug":"only-one-directory-argument-is-supported","errorCode":null,"errorMessage":"Only one directory argument is supported!","messagePattern":"Only one directory argument is supported!","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions-core/parquet-extensions/src/main/java/org/apache/druid/data/input/parquet/ParquetToJson.java","lineNumber":68,"sourceCode":"\n  @Option(name = \"--convert-corrupt-dates\")\n  public boolean convertCorruptDates = false;\n\n  @Arguments(description = \"directory\")\n  public List<String> directories;\n\n\n  public static void main(String[] args) throws Exception\n  {\n    CliBuilder<Callable> builder = Cli.builder(\"ParquetToJson\");\n    builder.withDefaultCommand(ParquetToJson.class);\n    builder.build().parse(args).call();\n  }\n\n  private File[] getInputFiles()\n  {\n    if (directories == null || directories.size() != 1) {\n      throw new IAE(\"Only one directory argument is supported!\");\n    }\n\n    File dir = new File(directories.get(0));\n    if (!dir.isDirectory()) {\n      throw new IAE(\"Not a directory [%s]\", dir);\n    }\n    File[] inputFiles = dir.listFiles(\n        pathname -> pathname.getName().endsWith(\".parquet\"));\n    if (inputFiles == null || inputFiles.length == 0) {\n      throw new IAE(\"No parquet files in directory [%s]\", dir);\n    }\n    return inputFiles;\n  }\n\n  @Override\n  public Void call() throws Exception\n  {\n    ObjectMapper mapper = new DefaultObjectMapper();","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/extensions-core/parquet-extensions/src/main/java/org/apache/druid/data/input/parquet/ParquetToJson.java#L50-L86","documentation":"ParquetToJson is a CLI utility that converts a single Parquet directory to JSON. getInputFiles() validates that exactly one directory argument was supplied; zero or multiple directories, or a non-directory path, throw IllegalArgumentException.","triggerScenarios":"Running the ParquetToJson tool with no directory argument, with more than one directory argument, or with a path that is not a directory.","commonSituations":"Passing multiple parquet dirs expecting batch conversion; quoting mistakes splitting one path into two args; passing a file path instead of the directory containing parquet files.","solutions":["Invoke the tool with exactly one directory argument containing the parquet files","Run the tool once per directory instead of passing multiple directories","Verify the argument points to a directory (not a single parquet file)"],"exampleFix":"// before\nParquetToJson dir1 dir2\n// after\nParquetToJson dir1\nParquetToJson dir2","handlingStrategy":"validation","validationCode":"if (args.length != 1 || !new File(args[0]).isDirectory()) { throw new IllegalArgumentException(\"Usage: ParquetToJson <single-directory>\"); }","typeGuard":null,"tryCatchPattern":"try { tool.run(args); } catch (IAE e) { if (e.getMessage().contains(\"Only one directory\")) { System.err.println(\"Usage: ParquetToJson <dir>\"); System.exit(2); } throw e; }","preventionTips":["Quote directory paths in shell to avoid accidental argument splitting","Validate the directory exists and is a directory before invoking the tool","Script per-directory invocations for batch conversions"],"tags":["cli","parquet","argument-validation","tooling"],"backgroundTag":"invalid-cli-argument","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}