{"record":{"id":"e544c4b5fb00560f","repo":"apache/cassandra","slug":"invalid-unset-value-in-condition","errorCode":null,"errorMessage":"Invalid 'unset' value in condition","messagePattern":"Invalid 'unset' value in condition","errorType":"validation","errorClass":"InvalidRequestException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/cql3/conditions/ColumnCondition.java","lineNumber":155,"sourceCode":"    {\n        ColumnMetadata column = columnsExpression.firstColumn();\n        TableMetadata table = columnsExpression.table();\n        ByteBuffer keyOrIndex = columnsExpression.element(context);\n        if (column.type.isCollection())\n        {\n            checkNotNull(keyOrIndex, \"Invalid null value for %s element access\", column.type instanceof MapType ? \"map\" : \"list\");\n        }\n        return new ElementOrFieldAccessBound(column, table, keyOrIndex, operator, toValue(columnsExpression.type(), bindAndGetTerms(context)));\n    }\n\n    private ByteBuffer toValue(AbstractType<?> type, List<ByteBuffer> values)\n    {\n        if (operator.isIN())\n            return ListType.getInstance(type, false).pack(values);\n\n        ByteBuffer value = values.get(0);\n        if (value == ByteBufferUtil.UNSET_BYTE_BUFFER)\n            throw invalidRequest(\"Invalid 'unset' value in condition\");\n\n        return value;\n    }\n\n    private List<ByteBuffer> bindAndGetTerms(FunctionContext context)\n    {\n        List<ByteBuffer> buffers = values.bindAndGet(context);\n        checkFalse(buffers == null && operator.isIN(), \"Invalid null list in IN condition\");\n        checkFalse(buffers == Term.UNSET_LIST, \"Invalid 'unset' value in condition\");\n        return filterUnsetValuesIfNeeded(buffers, ByteBufferUtil.UNSET_BYTE_BUFFER);\n    }\n\n    private <T> List<T> filterUnsetValuesIfNeeded(List<T> values, T unsetValue)\n    {\n        if (!operator.isIN())\n            return values;\n\n        List<T> filtered = new ArrayList<>(values.size());","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/cql3/conditions/ColumnCondition.java#L137-L173","documentation":"ColumnCondition.toValue found an 'unset' bound value in a condition; LWT conditions cannot compare against unset values because there is nothing to compare. Raised as InvalidRequestException while binding a condition.","triggerScenarios":"Thrown at src/java/org/apache/cassandra/cql3/conditions/ColumnCondition.java:155 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide an explicit value for the condition, or use the IS NOT/IS UNSET-style constructs where supported, instead of passing unset."],"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"}