{"record":{"id":"3202fa9a7dd18134","repo":"apache/cassandra","slug":"could-not-parse-update-query-querystring","errorCode":null,"errorMessage":"could not parse update query:${queryString}","messagePattern":"could not parse update query:(.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"tools/stress/src/org/apache/cassandra/stress/StressProfile.java","lineNumber":453,"sourceCode":"    }\n\n    static boolean dynamicConditionExists(PreparedStatement statement) throws IllegalArgumentException\n    {\n        if (statement == null)\n            return false;\n\n        if (!toUpperCaseLocalized(statement.getQueryString()).startsWith(\"UPDATE\"))\n            return false;\n\n        ModificationStatement.Parsed modificationStatement;\n        try\n        {\n            modificationStatement = CQLFragmentParser.parseAnyUnhandled(CqlParser::updateStatement,\n                                                                        statement.getQueryString());\n        }\n        catch (RecognitionException e)\n        {\n            throw new IllegalArgumentException(\"could not parse update query:\" + statement.getQueryString(), e);\n        }\n\n        /*\n         * here we differentiate between static vs dynamic conditions:\n         *  - static condition example: if col1 = NULL\n         *  - dynamic condition example: if col1 = ?\n         *  for static condition we don't have to replace value, no extra work involved.\n         *  for dynamic condition we have to read existing db value and then\n         *  use current db values during the update.\n         */\n        return modificationStatement.getConditions().stream().anyMatch(ColumnCondition.Raw::containsBindMarkers);\n    }\n\n    public Operation getBulkReadQueries(String name, Timer timer, StressSettings settings, TokenRangeIterator tokenRangeIterator, boolean isWarmup)\n    {\n        StressYaml.TokenRangeQueryDef def = tokenRangeQueries.get(name);\n        if (def == null)\n            throw new IllegalArgumentException(\"No bulk read query defined with name \" + name);","sourceCodeStart":435,"sourceCodeEnd":471,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/tools/stress/src/org/apache/cassandra/stress/StressProfile.java#L435-L471","documentation":"dynamicConditionExists parses the profile's UPDATE statement with the internal CQL ANTLR parser to detect dynamic (bind-marker) conditions. If parsing fails with a RecognitionException, an IllegalArgumentException wrapping the queryString is thrown. This means the query defined in the YAML is not valid CQL UPDATE syntax as far as the server-side parser is concerned.","triggerScenarios":"A 'queries' or 'inserts' definition whose queryString is an UPDATE statement with syntax errors (missing SET clause, malformed IF conditions, invalid identifiers), processed via getQuery -> dynamicConditionExists.","commonSituations":"Hand-written CQL typos in YAML, using CQL features unsupported by this Cassandra version's grammar, unescaped identifiers or strings, copy-pasted SQL that is not CQL.","solutions":["Fix the UPDATE statement syntax reported in the queryString; validate it with cqlsh first","Check for Cassandra-version-specific grammar differences (e.g. LWT IF conditions syntax)","Simplify the statement to isolate the offending fragment","Escape identifiers/strings correctly in the YAML"],"exampleFix":"# before\nqueries:\n  upd: UPDATE ks.t SET v = ? WHERE k = ? IF v =\n# after\nqueries:\n  upd: UPDATE ks.t SET v = ? WHERE k = ? IF v = ?","handlingStrategy":"validation","validationCode":"// smoke-test the UPDATE in cqlsh / via session before stress\nsession.execute(\"UPDATE ks.t SET v = ? WHERE k = ? IF v = ?\", 1, 1, 1);","typeGuard":null,"tryCatchPattern":"try { profile.getQuery(name, ...); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith(\"could not parse update query\")) log.error(\"Fix CQL syntax: {}\", e.getMessage()); throw e; }","preventionTips":["Validate query strings in cqlsh before adding to YAML","Avoid non-CQL (SQL) syntax in queries","Match grammar to your Cassandra version","Watch quotes/escapes inside YAML strings"],"tags":["cql","parser","yaml"],"backgroundTag":"sql-query-failed","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}