{"record":{"id":"2bfc49b4cdb3ce95","repo":"apache/cassandra","slug":"messagetemplate-caller-provided-message-template-2bfc49","errorCode":null,"errorMessage":"messageTemplate (caller-provided message template, 3 args)","messagePattern":"messageTemplate \\(caller-provided message template, 3 args\\)","errorType":"validation","errorClass":"InvalidRequestException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/cql3/statements/RequestValidations.java","lineNumber":118,"sourceCode":"    /**\n     * Checks that the specified expression is <code>true</code>. If not an {@code InvalidRequestException} will\n     * be thrown.\n     *\n     * @param expression the expression to test\n     * @param messageTemplate the template used to build the error message\n     * @param arg1 the first message argument\n     * @param arg2 the second message argument\n     * @param arg3 the third message argument\n     * @throws InvalidRequestException if the specified expression is {@code false}.\n     */\n    public static void checkTrue(boolean expression,\n                                 String messageTemplate,\n                                 Object arg1,\n                                 Object arg2,\n                                 Object arg3) throws InvalidRequestException\n    {\n        if (!expression)\n            throw invalidRequest(messageTemplate, arg1, arg2, arg3);\n    }\n\n    /**\n     * Checks that the specified collections is NOT <code>empty</code>.\n     * If it is an {@code InvalidRequestException} will be thrown.\n     *\n     * @param collection the collection to test\n     * @param messageTemplate the template used to build the error message\n     * @param messageArg the message argument\n     * @return the collection\n     * @throws InvalidRequestException if the specified collection is <code>empty</code>.\n     */\n    public static <T extends Collection<E>, E> T checkNotEmpty(T collection,\n                                                               String messageTemplate,\n                                                               Object messageArg)\n                                                               throws InvalidRequestException\n    {\n        checkTrue(!collection.isEmpty(), messageTemplate, messageArg);","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/cql3/statements/RequestValidations.java#L100-L136","documentation":"RequestValidations.checkTrue(boolean, String template, Object arg1, Object arg2, Object arg3) throws InvalidRequestException with a three-argument formatted message when the expression is false. Same guard family as the other checkTrue overloads in RequestValidations.","triggerScenarios":"Validation call sites interpolating three values where the checked condition is false during CQL statement validation.","commonSituations":"Complex multi-part preconditions failing, e.g. messages reporting function name, argument types and expected signature all at once.","solutions":["Read all three interpolated values in the message","Fix the CQL statement so the condition holds (often correcting one of the three reported items is enough)","Consult the docs for the feature mentioned in the message to learn the accepted forms"],"exampleFix":"// before\ncheckTrue(valid, \"function %s requires %s args, got %s\", fn, n, actual); // throws\n// after\n-- call sum(int_col) with exactly one int clustering column parameter","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { session.execute(stmt); }\ncatch (InvalidRequestException e) { throw new QueryValidationException(e.getMessage(), e); }","preventionTips":["Consult version-specific CQL docs for feature signatures (functions, options)","Validate multi-part preconditions client-side before sending"],"tags":["cql","validation","invalid-request"],"backgroundTag":"invalid-argument-value","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}