{"record":{"id":"9045f47226ba374c","repo":"apache/cassandra","slug":"s-doesn-t-exists-9045f4","errorCode":null,"errorMessage":"%s doesn't exists","messagePattern":"(.+?) doesn't exists","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"tools/stress/src/org/apache/cassandra/io/sstable/StressCQLSSTableWriter.java","lineNumber":407,"sourceCode":"        public Builder inDirectory(String directory)\n        {\n            return inDirectory(new File(directory));\n        }\n\n        /**\n         * The directory where to write the sstables (mandatory option).\n         * <p>\n         * This is a mandatory option.\n         *\n         * @param directory the directory to use, which should exist and be writable.\n         * @return this builder.\n         *\n         * @throws IllegalArgumentException if {@code directory} doesn't exist or is not writable.\n         */\n        public Builder inDirectory(File directory)\n        {\n            if (!directory.exists())\n                throw new IllegalArgumentException(directory + \" doesn't exists\");\n            if (!directory.canWrite())\n                throw new IllegalArgumentException(directory + \" exists but is not writable\");\n\n            directoryList.add(directory);\n            return this;\n        }\n\n        /**\n         * A pre-instanciated ColumnFamilyStore\n         * <p>\n         * This is can be used in place of inDirectory and forTable\n         *\n         * @see #inDirectory(File)\n         *\n         * @param cfs the list of directories to use, which should exist and be writable.\n         * @return this builder.\n         *\n         * @throws IllegalArgumentException if a directory doesn't exist or is not writable.","sourceCodeStart":389,"sourceCodeEnd":425,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/tools/stress/src/org/apache/cassandra/io/sstable/StressCQLSSTableWriter.java#L389-L425","documentation":"StressCQLSSTableWriter.Builder.inDirectory(File) validates that the given output directory exists before adding it to the writer's directory list. It throws IllegalArgumentException when the File does not exist on disk. The companion check (2633) covers existing-but-unwritable directories.","triggerScenarios":"Calling inDirectory(new File(path)) with a path that has not been created yet, a misspelled path, or a deleted directory.","commonSituations":"Typo in output path; assuming the tool creates directories automatically (it does not); path relative to a different working directory than expected; CI workspace missing the directory.","solutions":["Create the directory before calling inDirectory: Files.createDirectories(dir.toPath()).","Verify the path with dir.exists() before passing it.","Use an absolute path to avoid working-directory surprises.","Check for path typos in configuration."],"exampleFix":"// before\nbuilder.inDirectory(new File(\"/tmp/out\")); // may not exist\n// after\nFile dir = new File(\"/tmp/out\");\nFiles.createDirectories(dir.toPath());\nbuilder.inDirectory(dir);","handlingStrategy":"validation","validationCode":"File dir = new File(path);\nif (!dir.exists()) Files.createDirectories(dir.toPath());\nbuilder.inDirectory(dir);","typeGuard":null,"tryCatchPattern":"try { builder.inDirectory(dir); }\ncatch (IllegalArgumentException e) { throw new IllegalStateException(\"output dir missing, create it first: \" + dir, e); }","preventionTips":["Create output directories up front with Files.createDirectories.","Use absolute paths in tooling.","Check path spelling in configs.","Assert directory existence in setup code."],"tags":["filesystem","directory","sstable"],"backgroundTag":"directory-not-found","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}