{"record":{"id":"49e81dc57a5fd53c","repo":"apache/cassandra","slug":"no-ouptut-directory-specified-you-should-provide","errorCode":null,"errorMessage":"No ouptut directory specified, you should provide a directory with inDirectory()","messagePattern":"No ouptut directory specified, you should provide a directory with inDirectory\\(\\)","errorType":"validation","errorClass":"java.lang.IllegalStateException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/io/sstable/CQLSSTableWriter.java","lineNumber":696,"sourceCode":"            return this;\n        }\n\n        /**\n         * Use specific compression dictionary upon writing the data.\n         *\n         * @param compressionDictionary compression dictionary to use\n         * @return this builder\n         */\n        public Builder withCompressionDictionary(CompressionDictionary compressionDictionary)\n        {\n            this.compressionDictionary = compressionDictionary;\n            return this;\n        }\n\n        public CQLSSTableWriter build()\n        {\n            if (directory == null)\n                throw new IllegalStateException(\"No ouptut directory specified, you should provide a directory with inDirectory()\");\n            if (schemaStatement == null)\n                throw new IllegalStateException(\"Missing schema, you should provide the schema for the SSTable to create with forTable()\");\n            if (modificationStatement == null)\n                throw new IllegalStateException(\"No modification (INSERT/UPDATE/DELETE) statement specified, you should provide a modification statement through using()\");\n\n            Set<String> activeKeyspaces = new HashSet<>(SchemaConstants.LOCAL_SYSTEM_KEYSPACE_NAMES);\n\n            if (!DatabaseDescriptor.getAccordTransactionsEnabled())\n                activeKeyspaces.remove(SchemaConstants.ACCORD_KEYSPACE_NAME);\n\n            Preconditions.checkState(Sets.difference(activeKeyspaces, Schema.instance.getKeyspaces()).isEmpty(),\n                                     \"Local keyspaces were not loaded. If this is running as a client, please make sure to add %s=true system property.\",\n                                     CassandraRelevantProperties.FORCE_LOAD_LOCAL_KEYSPACES.getKey());\n\n            // Assign the default max SSTable size if not defined in builder\n            if (isMaxSSTableSizeUnset())\n            {\n                maxSSTableSizeInMiB = sorted ? -1L : DEFAULT_BUFFER_SIZE_IN_MIB_FOR_UNSORTED;","sourceCodeStart":678,"sourceCodeEnd":714,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/io/sstable/CQLSSTableWriter.java#L678-L714","documentation":"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.)","triggerScenarios":"Calling CQLSSTableWriter.builder()...build() without ever invoking inDirectory(...) on the Builder.","commonSituations":"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.","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"],"exampleFix":"// before\nCQLSSTableWriter writer = CQLSSTableWriter.builder()\n    .forTable(schema).using(insert).build();\n// after\nCQLSSTableWriter writer = CQLSSTableWriter.builder()\n    .inDirectory(\"/data/sstables/out\")\n    .forTable(schema).using(insert).build();","handlingStrategy":"validation","validationCode":"if (outputDir == null) throw new IllegalStateException(\"call inDirectory() before build()\");","typeGuard":"null","tryCatchPattern":"try { writer = builder.build(); } catch (IllegalStateException e) { if (e.getMessage().contains(\"inDirectory\")) { /* set directory and rebuild */ } throw e; }","preventionTips":["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"],"tags":["sstable","bulk-loading","builder","missing-config"],"backgroundTag":"missing-required-config","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"}