{"record":{"id":"df4b10cdcc88bc45","repo":"apache/cassandra","slug":"more-than-one-restriction-was-found-for-the-end-bo","errorCode":null,"errorMessage":"More than one restriction was found for the end bound on %s","messagePattern":"More than one restriction was found for the end bound on (.+?)","errorType":"validation","errorClass":"InvalidRequestException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/cql3/restrictions/MergedRestriction.java","lineNumber":169,"sourceCode":"            {\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\",\n                                      toCQLString(restriction.columns()));\n\n            if (restriction.isIN())\n                throw invalidRequest(\"%s cannot be restricted by more than one relation if it includes a IN\",\n                                     toCQLString(restriction.columns()));\n            if (restriction.isANN())\n                throw invalidRequest(\"%s cannot be restricted by more than one relation in an ANN ordering\",","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/cql3/restrictions/MergedRestriction.java#L151-L187","documentation":"The end-bound counterpart of error 3206: two restrictions both supply an upper bound (LT, LTE or BETWEEN) for the same clustering slice. Only one end bound is allowed, so MergedRestriction.validate() rejects the statement.","triggerScenarios":"A SELECT with two upper-bound restrictions, e.g. WHERE c1 < 10 AND (c1, c2) <= (10, 5), or two LT/LTE/BETWEEN relations sharing columns.","commonSituations":"Same as start-bound duplicates: mixing single-column and multi-column range syntax; ORM query builders emitting both a BETWEEN and an explicit < predicate.","solutions":["Keep only the tighter (or desired) upper-bound restriction","Rewrite as a single tuple restriction like (c1, c2) < (...)","Deduplicate range predicates in any code that assembles CQL dynamically"],"exampleFix":"// before\nSELECT * FROM t WHERE c1 <= 10 AND (c1, c2) <= (9, 9);\n// after\nSELECT * FROM t WHERE (c1, c2) <= (9, 9);","handlingStrategy":"validation","validationCode":"const upper = predicates.filter(p => ['<','<='].includes(p.op));\nif (upper.length > 1) throw new Error('Duplicate end bound on ' + upper.map(p => p.column));","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Express the end bound once, prefer tuple form for multi-column slices","Deduplicate upper-bound predicates in generated queries"],"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"}