{"record":{"id":"a0f325640e290c37","repo":"apache/cassandra","slug":"no-modification-insert-update-delete-statement-s","errorCode":null,"errorMessage":"No modification (INSERT/UPDATE/DELETE) statement specified, you should provide a modification statement through using()","messagePattern":"No modification \\(INSERT/UPDATE/DELETE\\) statement specified, you should provide a modification statement through using\\(\\)","errorType":"validation","errorClass":"java.lang.IllegalStateException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/io/sstable/CQLSSTableWriter.java","lineNumber":700,"sourceCode":"         * 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;\n            }\n\n            synchronized (CQLSSTableWriter.class)\n            {","sourceCodeStart":682,"sourceCodeEnd":718,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/io/sstable/CQLSSTableWriter.java#L682-L718","documentation":"Thrown by CQLSSTableWriter.Builder.build() as an IllegalStateException when no modification statement (INSERT/UPDATE/DELETE via using()) was configured. The writer serializes each added row by executing this prepared modification statement, so it cannot operate without one.","triggerScenarios":"Calling build() without invoking using(...) on the Builder.","commonSituations":"Builders configured for reading-only workflows mistakenly; the using() call wrapped in a try/catch for CQL syntax errors that swallowed a failed assignment and left the field null; refactoring that renamed the insert statement variable without updating the builder chain.","solutions":["Add .using(\"INSERT INTO ks.tbl (k, v) VALUES (?, ?)\") before build()","Fix any CQL syntax error in the statement passed to using() that caused setup to be skipped","Verify the statement's bound variables align with the schema and your row values"],"exampleFix":"// before\nCQLSSTableWriter writer = CQLSSTableWriter.builder()\n    .inDirectory(dir).forTable(schema).build();\n// after\nCQLSSTableWriter writer = CQLSSTableWriter.builder()\n    .inDirectory(dir).forTable(schema)\n    .using(\"INSERT INTO ks.tbl (k, v) VALUES (?, ?)\").build();","handlingStrategy":"validation","validationCode":"if (insertCql == null || insertCql.isEmpty()) throw new IllegalStateException(\"using() modification statement required before build()\");","typeGuard":"null","tryCatchPattern":"try { writer = builder.build(); } catch (IllegalStateException e) { if (e.getMessage().contains(\"modification\")) { /* supply using() and rebuild */ } throw e; }","preventionTips":["Use a single factory method that supplies schema + insert statement together","Catch SyntaxException from using() at setup time instead of swallowing it","Keep INSERT statements in sync with schema via shared constants and tests"],"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"}