apache/cassandra · error · IllegalArgumentException

%s doesn't exists

Error message

%s doesn't exists

What it means

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.

Source

Thrown at tools/stress/src/org/apache/cassandra/io/sstable/StressCQLSSTableWriter.java:407

        public Builder inDirectory(String directory)
        {
            return inDirectory(new File(directory));
        }

        /**
         * The directory where to write the sstables (mandatory option).
         * <p>
         * This is a mandatory option.
         *
         * @param directory the directory to use, which should exist and be writable.
         * @return this builder.
         *
         * @throws IllegalArgumentException if {@code directory} doesn't exist or is not writable.
         */
        public Builder inDirectory(File directory)
        {
            if (!directory.exists())
                throw new IllegalArgumentException(directory + " doesn't exists");
            if (!directory.canWrite())
                throw new IllegalArgumentException(directory + " exists but is not writable");

            directoryList.add(directory);
            return this;
        }

        /**
         * A pre-instanciated ColumnFamilyStore
         * <p>
         * This is can be used in place of inDirectory and forTable
         *
         * @see #inDirectory(File)
         *
         * @param cfs the list of directories to use, which should exist and be writable.
         * @return this builder.
         *
         * @throws IllegalArgumentException if a directory doesn't exist or is not writable.

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Create the directory before calling inDirectory: Files.createDirectories(dir.toPath()).
  2. Verify the path with dir.exists() before passing it.
  3. Use an absolute path to avoid working-directory surprises.
  4. Check for path typos in configuration.

Example fix

// before
builder.inDirectory(new File("/tmp/out")); // may not exist
// after
File dir = new File("/tmp/out");
Files.createDirectories(dir.toPath());
builder.inDirectory(dir);
Defensive patterns

Strategy: validation

Validate before calling

File dir = new File(path);
if (!dir.exists()) Files.createDirectories(dir.toPath());
builder.inDirectory(dir);

Try / catch

try { builder.inDirectory(dir); }
catch (IllegalArgumentException e) { throw new IllegalStateException("output dir missing, create it first: " + dir, e); }

Prevention

When it happens

Trigger: Calling inDirectory(new File(path)) with a path that has not been created yet, a misspelled path, or a deleted directory.

Common situations: 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.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/9045f47226ba374c. Report an issue: GitHub.