apache/cassandra · error · IllegalStateException
No output directories specified, you should provide a…
Error message
No output directories specified, you should provide a directory with inDirectory()
What it means
StressCQLSSTableWriter.Builder.build() performs mandatory configuration validation before constructing the writer. It throws IllegalStateException when neither inDirectory() was called nor an existing column family (cfs) supplied, so there is nowhere to write the generated SSTables.
Solutions
- Call builder.inDirectory(dir) with a valid writable directory before build().
- Alternatively provide an existing column family stream if building against a live table.
- Run inDirectory() early in the builder chain to make it structurally obvious.
- Add an explicit pre-check/assert for the directory in your setup code.
Example fix
// before
StressCQLSSTableWriter writer = StressCQLSSTableWriter.builder(schema).using(insert).build();
// after
StressCQLSSTableWriter writer = StressCQLSSTableWriter.builder(schema)
.inDirectory(new File("/tmp/sstables"))
.using(insert)
.build(); Defensive patterns
Strategy: validation
Validate before calling
if (outputDir == null) throw new IllegalStateException("output dir required before build()");
builder.inDirectory(outputDir); Try / catch
try { writer = builder.build(); }
catch (IllegalStateException e) { throw new IllegalStateException("builder misconfigured: " + e.getMessage(), e); } Prevention
- Always call inDirectory early in the builder chain.
- Build the writer via a single factory function so required steps cannot be skipped.
- Validate builder inputs in a wrapper around build().
- Never construct writers in conditional paths that may skip inDirectory.
When it happens
Trigger: Calling build() on a Builder where inDirectory() was never invoked (and no pre-existing CF was given).
Common situations: Constructing a writer programmatically with a minimal fluent chain and forgetting the output directory; conditional code paths that skip inDirectory; refactoring that dropped the call.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- No insert statement specified, you should provide an insert…
- Invalid number of arguments, expecting
- Invalid number of arguments, expecting
- Key in . is invalid in
- Missing schema, you should provide the schema for the…
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/0363223a52c2c672.
Report an issue: GitHub.
Appendix: source
Thrown at tools/stress/src/org/apache/cassandra/io/sstable/StressCQLSSTableWriter.java:577
* <p>
* You should thus only use this option is you know that you can provide
* the rows in order, which is rarely the case. If you can provide the
* rows in order however, using this sorted might be more efficient.
* <p>
* Note that if used, some option like withBufferSizeInMiB will be ignored.
*
* @return this builder.
*/
public Builder sorted()
{
this.sorted = true;
return this;
}
public StressCQLSSTableWriter build()
{
if (directoryList.isEmpty() && cfs == null)
throw new IllegalStateException("No output directories specified, you should provide a directory with inDirectory()");
if (schemaStatement == null && cfs == null)
throw new IllegalStateException("Missing schema, you should provide the schema for the SSTable to create with forTable()");
if (insertStatement == null)
throw new IllegalStateException("No insert statement specified, you should provide an insert statement through using()");
synchronized (StressCQLSSTableWriter.class)
{
if (cfs == null)
cfs = createOfflineTable(schemaStatement, typeStatements, directoryList);
if (partitioner == null)
partitioner = cfs.getPartitioner();
UpdateStatement preparedInsert = prepareInsert();
AbstractSSTableSimpleWriter writer = sorted
? new SSTableSimpleWriter(cfs.getDirectories().getDirectoryForNewSSTables(), cfs.metadata, preparedInsert.updatedColumns(), -1)
: new SSTableSimpleUnsortedWriter(cfs.getDirectories().getDirectoryForNewSSTables(), cfs.metadata, preparedInsert.updatedColumns(), bufferSizeInMiB);
View on GitHub (pinned to 88fd0f6a0e)