apache/cassandra · error · java.lang.IllegalStateException
No ouptut directory specified, you should provide a director
Error message
No ouptut directory specified, you should provide a directory with inDirectory()
What it means
Thrown by CQLSSTableWriter.Builder.build() as an IllegalStateException when no output directory was configured. The builder validates required configuration before constructing the writer; a directory is mandatory because SSTable files must be written somewhere. (Note the typo "ouptut" in the message.)
Source
Thrown at src/java/org/apache/cassandra/io/sstable/CQLSSTableWriter.java:696
return this;
}
/**
* Use specific compression dictionary upon writing the data.
*
* @param compressionDictionary compression dictionary to use
* @return this builder
*/
public Builder withCompressionDictionary(CompressionDictionary compressionDictionary)
{
this.compressionDictionary = compressionDictionary;
return this;
}
public CQLSSTableWriter build()
{
if (directory == null)
throw new IllegalStateException("No ouptut directory specified, you should provide a directory with inDirectory()");
if (schemaStatement == null)
throw new IllegalStateException("Missing schema, you should provide the schema for the SSTable to create with forTable()");
if (modificationStatement == null)
throw new IllegalStateException("No modification (INSERT/UPDATE/DELETE) statement specified, you should provide a modification statement through using()");
Set<String> activeKeyspaces = new HashSet<>(SchemaConstants.LOCAL_SYSTEM_KEYSPACE_NAMES);
if (!DatabaseDescriptor.getAccordTransactionsEnabled())
activeKeyspaces.remove(SchemaConstants.ACCORD_KEYSPACE_NAME);
Preconditions.checkState(Sets.difference(activeKeyspaces, Schema.instance.getKeyspaces()).isEmpty(),
"Local keyspaces were not loaded. If this is running as a client, please make sure to add %s=true system property.",
CassandraRelevantProperties.FORCE_LOAD_LOCAL_KEYSPACES.getKey());
// Assign the default max SSTable size if not defined in builder
if (isMaxSSTableSizeUnset())
{
maxSSTableSizeInMiB = sorted ? -1L : DEFAULT_BUFFER_SIZE_IN_MIB_FOR_UNSORTED;View on GitHub (pinned to 88fd0f6a0e)
Solutions
- Add .inDirectory(path) to the builder chain before build()
- Ensure the code path that builds the writer always sets the directory
- Validate configuration in setup code so missing builder options fail early
Example fix
// before
CQLSSTableWriter writer = CQLSSTableWriter.builder()
.forTable(schema).using(insert).build();
// after
CQLSSTableWriter writer = CQLSSTableWriter.builder()
.inDirectory("/data/sstables/out")
.forTable(schema).using(insert).build(); Defensive patterns
Strategy: validation
Validate before calling
if (outputDir == null) throw new IllegalStateException("call inDirectory() before build()"); Type guard
null
Try / catch
try { writer = builder.build(); } catch (IllegalStateException e) { if (e.getMessage().contains("inDirectory")) { /* set directory and rebuild */ } throw e; } Prevention
- Centralize builder construction in one helper that always sets directory, schema, and using()
- Fail fast in your own config loading when the output path is missing
- Add a unit test asserting the writer builds with all required options
When it happens
Trigger: Calling CQLSSTableWriter.builder()...build() without ever invoking inDirectory(...) on the Builder.
Common situations: Constructing the writer programmatically where the builder chain is assembled conditionally and the inDirectory call is skipped on some code path; refactoring that dropped the inDirectory call; copying example code that used a different builder method name.
Understand the failure class
Background: "X is required", "must be set", "cannot be empty": the missing-required-config error family, from Vertex AI project/location to WeChat keys — this error's family across 18 libraries.
Related errors
- No modification (INSERT/UPDATE/DELETE) statement specified,
- Missing schema, you should provide the schema for the SSTabl
- Invalid number of arguments, expecting %d values but got %d
- %s doesn't exists
- %s exists but is not writable
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/49e81dc57a5fd53c.
Report an issue: GitHub.