apache/cassandra · error · IllegalArgumentException
There was a problem parsing the table cql: %s
Error message
There was a problem parsing the table cql: %s
What it means
StressProfile.init parses the table_definition CQL with CqlParser::createTableStatement; RecognitionException or RuntimeException during parsing is converted to IllegalArgumentException "There was a problem parsing the table cql: <message>". It signals that the CREATE TABLE statement in the stress profile is syntactically invalid, empty, or not a table-creation statement. A failed assert also indicates the table name in the definition does not match the tableName property.
Source
Thrown at tools/stress/src/org/apache/cassandra/stress/StressProfile.java:234
{
throw new IllegalArgumentException("There was a problem parsing the keyspace cql: " + e.getMessage());
}
}
else
{
keyspaceCql = null;
}
if (tableCql != null && tableCql.length() > 0)
{
try
{
String name = CQLFragmentParser.parseAnyUnhandled(CqlParser::createTableStatement, tableCql).table();
assert name.equalsIgnoreCase(tableName) : "Name in table_definition doesn't match table property: '" + name + "' != '" + tableName + "'";
}
catch (RecognitionException | RuntimeException e)
{
throw new IllegalArgumentException("There was a problem parsing the table cql: " + e.getMessage());
}
}
else
{
tableCql = null;
}
columnConfigs = new HashMap<>();
if (yaml.columnspec != null)
{
for (Map<String, Object> spec : yaml.columnspec)
{
lowerCase(spec);
String name = (String) spec.remove("name");
DistributionFactory population = !spec.containsKey("population") ? null : OptionDistribution.get((String) spec.remove("population"));
DistributionFactory size = !spec.containsKey("size") ? null : OptionDistribution.get((String) spec.remove("size"));
DistributionFactory clustering = !spec.containsKey("cluster") ? null : OptionDistribution.get((String) spec.remove("cluster"));View on GitHub (pinned to 88fd0f6a0e)
Solutions
- Fix the CQL syntax reported in the exception message inside table_definition.
- Ensure the definition is exactly one CREATE TABLE statement named identically to the profile's table property.
- Validate the schema with cqlsh against the target Cassandra version before using it in the stress profile.
- Check YAML block-scalar indentation/quoting so the full multi-line CQL reaches the parser intact.
Example fix
// before (profile YAML) table_definition: | CREATE TABLE ks.tbl (id text PRIMARY KEY // after table_definition: | CREATE TABLE ks.tbl (id text PRIMARY KEY, value blob);
Defensive patterns
Strategy: validation
Validate before calling
String cql = profile.tableDefinition; if (cql == null || cql.trim().isEmpty() || !cql.trim().toUpperCase().startsWith("CREATE TABLE")) throw new IllegalArgumentException("table_definition must be a single CREATE TABLE statement matching table: " + profile.table); Try / catch
try { profile.init(stressSettings); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith("There was a problem parsing the table cql")) System.err.println("Fix table_definition in your stress profile YAML: " + e.getMessage()); throw e; } Prevention
- Validate the CREATE TABLE statement with cqlsh on the target Cassandra version.
- Include exactly one statement per table_definition and match the table property name.
- Watch YAML quoting/indentation so multi-line CQL is not truncated or merged.
When it happens
Trigger: A table_definition in the stress profile with CQL syntax errors, non-CREATE-TABLE content, parser-visible RuntimeExceptions (e.g. null/empty definition reaching the parser), or a declared table name differing from the profile's table property.
Common situations: Hand-written schemas with typos or missing closing parentheses; definitions containing multiple statements the single-statement parser rejects; empty table_definition string; version drift between profile CQL syntax and the bundled ANTLR parser; YAML quoting mistakes that truncate the statement.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- There was a problem parsing the keyspace cql: %s
- Invalid or malformed
- (dynamic first syntax error message from parser/lexer)
- Could not decode JSON string as a map: %s. (String was: %s)
- Unable to convert '%s' to a duration
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/69f42ea2ee19ac85.
Report an issue: GitHub.