apache/cassandra · error · InvalidConstraintDefinitionException
Constraints combination of %s is not supported: %s %s %s, %s
Error message
Constraints combination of %s is not supported: %s %s %s, %s %s %s
What it means
ensureSatisfiability checks pairs of constraints on a column for logically impossible or redundant combinations. Combinations like GT+GTE, LT+LTE, or any pair involving EQ are rejected outright because they cannot (or trivially do) constrain anything meaningful; the exception lists the constraint name, column, both relations and terms.
Source
Thrown at src/java/org/apache/cassandra/cql3/constraints/AbstractFunctionSatisfiabilityChecker.java:138
private void ensureSatisfiability(ColumnMetadata columnMetadata,
String constraintName,
List<CONSTRAINT_TYPE> allConstraints)
{
if (allConstraints.size() != 2)
return;
Operator firstRelation = allConstraints.get(0).relationType();
String firstTerm = allConstraints.get(0).term();
Operator secondRelation = allConstraints.get(1).relationType();
String secondTerm = allConstraints.get(1).term();
if ((firstRelation == GT && secondRelation == GTE) ||
(firstRelation == GTE && secondRelation == GT) ||
(firstRelation == LT && secondRelation == LTE) ||
(firstRelation == LTE && secondRelation == LT) ||
(firstRelation == EQ || secondRelation == EQ))
{
throw new InvalidConstraintDefinitionException(format("Constraints combination of %s is not supported: %s %s %s, %s %s %s",
constraintName,
columnMetadata.name,
firstRelation,
firstTerm,
columnMetadata.name,
secondRelation,
secondTerm));
}
else if (firstRelation == NEQ && secondRelation == NEQ)
{
if (firstTerm.equals(secondTerm))
throw new InvalidConstraintDefinitionException(format("There are duplicate constraint definitions on column '%s'.", columnMetadata.name));
}
else
{
AbstractType<?> returnType = returnType(columnMetadata);
ByteBuffer firstTermBuffer = returnType.fromString(ParseUtils.unquote(firstTerm));
ByteBuffer secondTermBuffer = returnType.fromString(ParseUtils.unquote(secondTerm));View on GitHub (pinned to 88fd0f6a0e)
Solutions
- Remove the redundant constraint of each rejected pair (e.g. drop the GT when GTE is present).
- Replace EQ+range combos with a single equality constraint only.
- Merge the two relations into a single well-formed range constraint.
Example fix
// before CREATE TABLE t (x int CHECK x > 5 AND x >= 5); // after CREATE TABLE t (x int CHECK x >= 5);
Defensive patterns
Strategy: validation
Validate before calling
if (first == Operator.EQ || second == Operator.EQ) throw new IllegalArgumentException("EQ cannot be combined with another constraint");
if ((first == Operator.GT && second == Operator.GTE) || (first == Operator.GTE && second == Operator.GT)
|| (first == Operator.LT && second == Operator.LTE) || (first == Operator.LTE && second == Operator.LT))
throw new IllegalArgumentException("Redundant constraint pair"); Try / catch
try {
session.execute(schemaDdl);
} catch (InvalidRequestException e) {
if (e.getMessage().contains("Constraints combination")) {
log.error("Remove redundant/conflicting constraint pair: {}", e.getMessage());
} else throw e;
} Prevention
- Express each column's bounds as one minimal pair of constraints
- Lint generated DDL for redundant relations
- Prefer >= / <= over mixed >/>= pairs
When it happens
Trigger: CREATE TABLE/ALTER TABLE declaring two constraints on one column where one is EQ, or where relations are GT>E or LT<E against each other.
Common situations: Writing redundant bounds (x > 5 AND x >= 5); accidentally specifying both an equality and a range on the same column; translating RDBMS CHECK semantics that Cassandra rejects.
Understand the failure class
Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.
Related errors
- Constraints of %s are not satisfiable: %s %s %s, %s %s %s
- %s constraint of relation '%s' is not supported. Only these
- There can not be more than 2 constraints (not including non-
- There are duplicate constraint definitions on column '%s': %
- There are duplicate constraint definitions on column '%s'.
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/6110944a1b81cbde.
Report an issue: GitHub.