apache/cassandra · error · java.lang.IllegalArgumentException

%s doesn't exists

Error message

%s doesn't exists

What it means

Thrown by CQLSSTableWriter.Builder.inDirectory(File) as an IllegalArgumentException when the given directory does not exist on the filesystem. The builder requires a valid, existing output directory before any SSTables can be written. (Note the message text has a known grammar typo: "doesn't exists".)

Source

Thrown at src/java/org/apache/cassandra/io/sstable/CQLSSTableWriter.java:456

         */
        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 exists 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.isWritable())
                throw new IllegalArgumentException(directory + " exists but is not writable");

            this.directory = directory;
            return this;
        }

        public Builder withType(String typeDefinition) throws SyntaxException
        {
            typeStatements.add(QueryProcessor.parseStatement(typeDefinition, CreateTypeStatement.Raw.class, "CREATE TYPE"));
            return this;
        }

        /**
         * The schema (CREATE TABLE statement) for the table for which sstable are to be created.
         * <p>
         * Please note that the provided CREATE TABLE statement <b>must</b> use a fully-qualified
         * table name, one that include the keyspace name.

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Create the directory before passing it: new File(dir).mkdirs()
  2. Verify the absolute path with directory.getAbsolutePath() to catch relative-path mistakes
  3. Check mounts/volumes exist when running in containers or CI
  4. Use inDirectory(String) with a verified path and assert existence in setup code

Example fix

// before
File dir = new File("/data/sstables/output");
CQLSSTableWriter.builder().inDirectory(dir);
// after
File dir = new File("/data/sstables/output");
if (!dir.exists() && !dir.mkdirs()) throw new IllegalStateException("cannot create " + dir);
CQLSSTableWriter.builder().inDirectory(dir);
Defensive patterns

Strategy: validation

Validate before calling

File dir = new File(path); if (!dir.exists()) { if (!dir.mkdirs()) throw new IllegalStateException("cannot create " + dir); }

Type guard

null

Try / catch

try { builder.inDirectory(dir); } catch (IllegalArgumentException e) { // 'doesn't exists' vs 'not writable' — create or fix permissions accordingly }

Prevention

When it happens

Trigger: Calling CQLSSTableWriter.builder().inDirectory(new File("/path/that/does/not/exist")) or inDirectory(File) with a path that was deleted after the File handle was created.

Common situations: Typos in output paths; assuming inDirectory creates the directory (it does not — use File.mkdir(s) first); relative paths resolved against an unexpected working directory in the bulk-loader environment; container/CI setups where the mount is absent.

Related errors


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