{"record":{"id":"69f42ea2ee19ac85","repo":"apache/cassandra","slug":"there-was-a-problem-parsing-the-table-cql-s","errorCode":null,"errorMessage":"There was a problem parsing the table cql: %s","messagePattern":"There was a problem parsing the table cql: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"tools/stress/src/org/apache/cassandra/stress/StressProfile.java","lineNumber":234,"sourceCode":"            {\n                throw new IllegalArgumentException(\"There was a problem parsing the keyspace cql: \" + e.getMessage());\n            }\n        }\n        else\n        {\n            keyspaceCql = null;\n        }\n\n        if (tableCql != null && tableCql.length() > 0)\n        {\n            try\n            {\n                String name = CQLFragmentParser.parseAnyUnhandled(CqlParser::createTableStatement, tableCql).table();\n                assert name.equalsIgnoreCase(tableName) : \"Name in table_definition doesn't match table property: '\" + name + \"' != '\" + tableName + \"'\";\n            }\n            catch (RecognitionException | RuntimeException e)\n            {\n                throw new IllegalArgumentException(\"There was a problem parsing the table cql: \" + e.getMessage());\n            }\n        }\n        else\n        {\n            tableCql = null;\n        }\n\n        columnConfigs = new HashMap<>();\n\n        if (yaml.columnspec != null)\n        {\n            for (Map<String, Object> spec : yaml.columnspec)\n            {\n                lowerCase(spec);\n                String name = (String) spec.remove(\"name\");\n                DistributionFactory population = !spec.containsKey(\"population\") ? null : OptionDistribution.get((String) spec.remove(\"population\"));\n                DistributionFactory size = !spec.containsKey(\"size\") ? null : OptionDistribution.get((String) spec.remove(\"size\"));\n                DistributionFactory clustering = !spec.containsKey(\"cluster\") ? null : OptionDistribution.get((String) spec.remove(\"cluster\"));","sourceCodeStart":216,"sourceCodeEnd":252,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/tools/stress/src/org/apache/cassandra/stress/StressProfile.java#L216-L252","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before (profile YAML)\ntable_definition: |\n  CREATE TABLE ks.tbl (id text PRIMARY KEY\n// after\ntable_definition: |\n  CREATE TABLE ks.tbl (id text PRIMARY KEY, value blob);","handlingStrategy":"validation","validationCode":"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);","typeGuard":null,"tryCatchPattern":"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; }","preventionTips":["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."],"tags":["cql","parsing","stress-profile"],"backgroundTag":"invalid-argument-format","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}