apache/cassandra · error · InvalidRequestException
messageTemplate (caller-provided message template, 2 args)
Error message
messageTemplate (caller-provided message template, 2 args)
What it means
RequestValidations.checkTrue(boolean, String template, Object arg1, Object arg2) throws InvalidRequestException with a two-argument formatted message when the expression is false. It is a standard guard in CQL statement validation; message content is defined by each caller.
Source
Thrown at src/java/org/apache/cassandra/cql3/statements/RequestValidations.java:97
}
/**
* Checks that the specified expression is <code>true</code>. If not an {@code InvalidRequestException} will
* be thrown.
*
* @param expression the expression to test
* @param messageTemplate the template used to build the error message
* @param arg1 the first message argument
* @param arg2 the second message argument
* @throws InvalidRequestException if the specified expression is {@code false}.
*/
public static void checkTrue(boolean expression,
String messageTemplate,
Object arg1,
Object arg2) throws InvalidRequestException
{
if (!expression)
throw invalidRequest(messageTemplate, arg1, arg2);
}
/**
* Checks that the specified expression is <code>true</code>. If not an {@code InvalidRequestException} will
* be thrown.
*
* @param expression the expression to test
* @param messageTemplate the template used to build the error message
* @param arg1 the first message argument
* @param arg2 the second message argument
* @param arg3 the third message argument
* @throws InvalidRequestException if the specified expression is {@code false}.
*/
public static void checkTrue(boolean expression,
String messageTemplate,
Object arg1,
Object arg2,
Object arg3) throws InvalidRequestExceptionView on GitHub (pinned to 88fd0f6a0e)
Solutions
- Read both interpolated values in the message to see the expected-vs-actual mismatch
- Adjust the CQL statement so the validated relationship holds
- Check the schema (system_schema) for types involved if the mismatch is type-related
Example fix
// before checkTrue(a.type.equals(b.type), "type mismatch: %s vs %s", a.type, b.type); // throws // after -- use compatible types, e.g. cast or alter the table so both columns share a type
Defensive patterns
Strategy: try-catch
Try / catch
try { session.execute(stmt); }
catch (InvalidRequestException e) { // expected-vs-actual in message
log.warn("CQL validation failed: {}", e.getMessage()); } Prevention
- Check column types in system_schema.columns when comparing/joining columns
- Avoid mixing differently-typed columns in the same expression
When it happens
Trigger: Validation call sites using two interpolated values (e.g. expected vs actual) where the checked condition fails during statement prepare/execute.
Common situations: Queries mixing incompatible elements, e.g. comparing columns of different types or wrong number/order of clauses, with both offending items named in the message.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- message (caller-provided message string)
- messageTemplate (caller-provided message template, 1 arg)
- messageTemplate (caller-provided message template, 3 args)
- Invalid tuple literal for %s: too many elements. Type %s exp
- REVOKE operation is not supported by AllowAllAuthorizer
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/1eb92a4251c7bc20.
Report an issue: GitHub.