{"record":{"id":"c7e75c2548d53148","repo":"apache/cassandra","slug":"invalid-null-set-element","errorCode":null,"errorMessage":"Invalid null set element","messagePattern":"Invalid null set element","errorType":"validation","errorClass":"InvalidRequestException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/cql3/terms/Sets.java","lineNumber":339,"sourceCode":"\n            for (ByteBuffer bb : toDiscard)\n                builder.addTombstone(column, CellPath.create(bb));\n        }\n    }\n\n    public static class ElementDiscarder extends Operation\n    {\n        public ElementDiscarder(ColumnMetadata column, Term k)\n        {\n            super(column, k);\n        }\n\n        public void execute(DecoratedKey partitionKey, RowUpdateBuilder builder) throws InvalidRequestException\n        {\n            assert column.type.isMultiCell() : \"Attempted to delete a single element in a frozen set\";\n            Term.Terminal elt = t.bind(builder);\n            if (elt == null)\n                throw new InvalidRequestException(\"Invalid null set element\");\n\n            builder.addTombstone(column, CellPath.create(elt.get()));\n        }\n    }\n}\n","sourceCodeStart":321,"sourceCodeEnd":345,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/cql3/terms/Sets.java#L321-L345","documentation":"In ElementDiscarder.execute (DELETE m[key] on a non-frozen set), the bound key term evaluated to null. A null element cannot identify a set member to tombstone, so the deletion is rejected with InvalidRequestException before adding the tombstone.","triggerScenarios":"Thrown at src/java/org/apache/cassandra/cql3/terms/Sets.java:339 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the term bound for the set element does not evaluate to null before executing the delete","Guard the delete operation so it is skipped when the element term binds to null"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}