apache/cassandra · error · InvalidConstraintDefinitionException
There are duplicate constraint definitions on column '%s'.
Error message
There are duplicate constraint definitions on column '%s'.
What it means
If two NEQ constraints on a column reference the exact same term, ensureSatisfiability flags them as duplicate constraint definitions and throws InvalidConstraintDefinitionException with the column name. This is the pairwise duplicate check complementing the bulk check in checkNumberOfConstraints.
Source
Thrown at src/java/org/apache/cassandra/cql3/constraints/AbstractFunctionSatisfiabilityChecker.java:150
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));
boolean firstSatisfaction = firstRelation.isSatisfiedBy(returnType, secondTermBuffer, firstTermBuffer);
boolean secondSatisfaction = secondRelation.isSatisfiedBy(returnType, firstTermBuffer, secondTermBuffer);
if (!firstSatisfaction || !secondSatisfaction)
throw new InvalidConstraintDefinitionException(format("Constraints of %s are not satisfiable: %s %s %s, %s %s %s",
constraintName,
columnMetadata.name,
firstRelation,
firstTerm,
columnMetadata.name,
secondRelation,View on GitHub (pinned to 88fd0f6a0e)
Solutions
- Delete one of the duplicated NEQ constraints.
- Deduplicate exclusion lists before generating DDL.
- Compare existing table definition with the new DDL to avoid re-adding constraints.
Example fix
// before CHECK v != 'a' AND v != 'a' // after CHECK v != 'a'
Defensive patterns
Strategy: validation
Validate before calling
if (neqA.term().equals(neqB.term()))
throw new IllegalArgumentException("Duplicate NEQ constraint on column"); Try / catch
try {
session.execute(schemaDdl);
} catch (InvalidRequestException e) {
if (e.getMessage().endsWith("duplicate constraint definitions")) {
log.error("Drop one of the identical NEQ constraints: {}", e.getMessage());
} else throw e;
} Prevention
- Compare new DDL with existing schema before applying
- Use Set semantics when materializing exclusion rules
When it happens
Trigger: Two NEQ constraints on the same column whose term strings are equal, e.g. CHECK v != 'a' AND v != 'a'.
Common situations: Hand-written DDL with repeated clauses; schema tooling appending identical exclusions from two rule sources.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- There are duplicate constraint definitions on column '%s': %
- %s constraint of relation '%s' is not supported. Only these
- There can not be more than 2 constraints (not including non-
- Constraints combination of %s is not supported: %s %s %s, %s
- Constraints of %s are not satisfiable: %s %s %s, %s %s %s
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/e7e5ffc5d1cea505.
Report an issue: GitHub.