{"record":{"id":"da131abc66e69f17","repo":"apache/cassandra","slug":"more-than-one-restriction-was-found-for-the-start","errorCode":null,"errorMessage":"More than one restriction was found for the start bound on %s","messagePattern":"More than one restriction was found for the start bound on (.+?)","errorType":"validation","errorClass":"InvalidRequestException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/cql3/restrictions/MergedRestriction.java","lineNumber":162,"sourceCode":"        }\n\n        if (restriction.isSlice() && other.isSlice())\n        {\n            ColumnMetadata firstColumn = restriction.firstColumn();\n            ColumnMetadata otherFirstColumn = other.firstColumn();\n            if (!firstColumn.equals(otherFirstColumn))\n            {\n                ColumnMetadata column = firstColumn.position() > otherFirstColumn.position() ? firstColumn\n                                                                                             : otherFirstColumn;\n\n                throw invalidRequest(\"Column \\\"%s\\\" cannot be restricted by two inequalities not starting with the same column\",\n                                     column.name);\n            }\n\n            if ((restriction.operator() == Operator.GT || restriction.operator() == Operator.GTE || restriction.operator() == Operator.BETWEEN) &&\n                    (other.operator() == Operator.GT || other.operator() == Operator.GTE || other.operator() == Operator.BETWEEN))\n            {\n                throw invalidRequest(\"More than one restriction was found for the start bound on %s\",\n                                     toCQLString(getColumnsInCommons(restriction, other)));\n            }\n\n            if ((restriction.operator() == Operator.LT || restriction.operator() == Operator.LTE || restriction.operator() == Operator.BETWEEN) &&\n                    (other.operator() == Operator.LT || other.operator() == Operator.LTE || other.operator() == Operator.BETWEEN))\n            {\n                throw invalidRequest(\"More than one restriction was found for the end bound on %s\",\n                                     toCQLString(getColumnsInCommons(restriction, other)));\n            }\n        }\n    }\n\n    private static void checkOperator(SimpleRestriction restriction)\n    {\n        if (restriction.isColumnLevel() || restriction.isOnToken())\n        {\n            if (restriction.isEQ())\n                throw invalidRequest(\"%s cannot be restricted by more than one relation if it includes an Equal\",","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/cql3/restrictions/MergedRestriction.java#L144-L180","documentation":"Thrown when two restrictions both constrain the START bound of the same clustering slice — i.e. both operators are GT, GTE or BETWEEN on overlapping columns. A slice can have only one lower bound, so merging them is impossible and validation fails.","triggerScenarios":"A SELECT with two lower-bound inequalities such as WHERE c1 > 1 AND (c1, c2) > (1, 2), or two > / >= / BETWEEN relations whose columns intersect, passed to MergedRestriction.validate().","commonSituations":"Combining a simple inequality with a multi-column (tuple) inequality over the same columns; hand-built queries from ORMs/query builders that append range predicates without deduplication.","solutions":["Remove one of the duplicate lower-bound restrictions or make them consistent","Express the tighter bound once using a single tuple (c1, c2) > (...) restriction","Have the query builder merge/overwrite range predicates instead of appending both"],"exampleFix":"// before\nSELECT * FROM t WHERE c1 > 1 AND (c1, c2) > (1, 5);\n// after\nSELECT * FROM t WHERE (c1, c2) > (1, 5);","handlingStrategy":"validation","validationCode":"// deduplicate lower-bound predicates before building the query\nconst lower = predicates.filter(p => ['>','>='].includes(p.op));\nif (lower.length > 1) throw new Error('Duplicate start bound on ' + lower.map(p => p.column));","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never mix single-column and tuple inequality over the same columns","Have query builders overwrite rather than append range predicates","Keep slice bounds in one place in your data-access layer"],"tags":["cql","query-validation","slice-bounds"],"backgroundTag":"invalid-query-parameter","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T21:17:11.552Z"}