apache/cassandra · error · java.lang.IllegalArgumentException
Provided preparedModificationStatement statement has no…
Error message
Provided preparedModificationStatement statement has no bind variables
What it means
CQLSSTableWriter exists to bind values into a prepared modification statement; a statement with zero bind variables cannot be batched/reused for bulk rows, so the Builder rejects it with an IllegalArgumentException. This is a usability guard that almost always indicates the statement was written with literal values instead of ? placeholders.
Solutions
- Rewrite the statement with ? placeholders for the values you will bind per row
- If you truly need a one-off literal write, use a regular session.execute of the literal CQL instead of CQLSSTableWriter
- Check any string templating that might have substituted values before the statement reached the builder
Example fix
// before String cql = "INSERT INTO ks.t (k, v) VALUES (1, 2)"; // after String cql = "INSERT INTO ks.t (k, v) VALUES (?, ?)"; writer.addRow(1, 2);
Defensive patterns
Strategy: validation
Validate before calling
if (!cql.contains("?"))
throw new IllegalArgumentException("Statement must contain bind variables for CQLSSTableWriter"); Try / catch
try { builder.build(); }
catch (IllegalArgumentException e) {
if (e.getMessage().contains("has no bind variables"))
// rewrite statement with ? placeholders
} Prevention
- Always parameterize bulk-load statements with ? placeholders
- Avoid templating that substitutes literals before preparation
- Count expected bind markers against addRow arity
When it happens
Trigger: Passing a fully literal statement like 'INSERT INTO ks.t (k, v) VALUES (1, 2)' (no ? markers) to CQLSSTableWriter and calling build().
Common situations: Hardcoded single-row loads; templating bugs where interpolation happened before preparation, leaving no placeholders.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Conditional statements are not supported
- Counter modification statements are not supported
- Invalid number of arguments, expecting
- Missing schema, you should provide the schema for the…
- No modification (INSERT/UPDATE/DELETE) statement specified…
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/4cd429ec6151d7d4.
Report an issue: GitHub.
Appendix: source
Thrown at src/java/org/apache/cassandra/io/sstable/CQLSSTableWriter.java:921
}
/**
* Prepares modification statement for writing data to SSTable
*
* @return prepared modification statement and it's bound names
*/
private ModificationStatement prepareModificationStatement()
{
ClientState state = ClientState.forInternalCalls();
ModificationStatement preparedModificationStatement = modificationStatement.prepare(state);
preparedModificationStatement.validate(state);
if (preparedModificationStatement.hasConditions())
throw new IllegalArgumentException("Conditional statements are not supported");
if (preparedModificationStatement.isCounter())
throw new IllegalArgumentException("Counter modification statements are not supported");
if (preparedModificationStatement.getBindVariables().isEmpty())
throw new IllegalArgumentException("Provided preparedModificationStatement statement has no bind variables");
return preparedModificationStatement;
}
}
}
View on GitHub (pinned to 88fd0f6a0e)