{"record":{"id":"87abe4eda80dcf0e","repo":"apache/cassandra","slug":"no-query-defined-with-name-name","errorCode":null,"errorMessage":"No query defined with name ${name}","messagePattern":"No query defined with name (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"tools/stress/src/org/apache/cassandra/stress/StressProfile.java","lineNumber":406,"sourceCode":"                    sortedRanges.add(range);\n            }\n\n            Collections.sort(sortedRanges);\n            tokenRanges = new LinkedHashSet<>(sortedRanges);\n            return tokenRanges;\n        }\n    }\n\n    public Operation getQuery(String name,\n                              Timer timer,\n                              PartitionGenerator generator,\n                              SeedManager seeds,\n                              StressSettings settings,\n                              boolean isWarmup)\n    {\n        name = toLowerCaseLocalized(name);\n        if (!queries.containsKey(name))\n            throw new IllegalArgumentException(\"No query defined with name \" + name);\n\n        if (queryStatements == null)\n        {\n            synchronized (this)\n            {\n                if (queryStatements == null)\n                {\n                    JavaDriverClient jclient = settings.getJavaDriverClient(keyspaceName);\n\n                    Map<String, PreparedStatement> stmts = new HashMap<>();\n                    Map<String, SchemaStatement.ArgSelect> args = new HashMap<>();\n                    for (Map.Entry<String, StressYaml.QueryDef> e : queries.entrySet())\n                    {\n                        stmts.put(toLowerCaseLocalized(e.getKey()), jclient.prepare(e.getValue().cql));\n                        args.put(toLowerCaseLocalized(e.getKey()), e.getValue().fields == null\n                                ? SchemaStatement.ArgSelect.MULTIROW\n                                : SchemaStatement.ArgSelect.valueOf(toUpperCaseLocalized(e.getValue().fields)));\n                    }","sourceCodeStart":388,"sourceCodeEnd":424,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/tools/stress/src/org/apache/cassandra/stress/StressProfile.java#L388-L424","documentation":"getQuery resolves a named query defined in the stress profile YAML. If the name (lowercased for lookup) is not present in the queries map, an IllegalArgumentException is thrown. It guards against referencing queries that were never declared in the profile.","triggerScenarios":"Calling profile.get(...) with an operation/query name that is not declared under the 'queries:' section of the profile YAML (or with wrong case that still does not match after lowercasing).","commonSituations":"Typos in the query name on the command line or in the YAML, invoking a named query from a different profile file, case mismatches beyond simple lowercasing.","solutions":["Add the missing named query to the 'queries' section of the profile YAML","Fix the typo in the query name used in the stress command/operation spec","List the queries defined in the YAML and pick an existing name","Remember names are lowercased before lookup - use the exact lowercased key"],"exampleFix":"# before\nstress run profile=my.yaml op=query1\n# after (yaml defines 'queries: mainquery: ...')\nstress run profile=my.yaml op=mainquery","handlingStrategy":"validation","validationCode":"// check the query name is defined in the profile YAML before invoking\nSet<String> defined = yamlProfile.getQueries().keySet();\nif (!defined.contains(queryName.toLowerCase())) throw new IllegalArgumentException(\"unknown query: \" + queryName);","typeGuard":null,"tryCatchPattern":"try { profile.get(name, ...); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith(\"No query defined\")) log.error(\"Available queries: {}\", yamlProfile.getQueries().keySet()); throw e; }","preventionTips":["Define every query you invoke under 'queries:' in the profile YAML","Names are lowercased - use the lowercased key","Keep the command line's op name in sync with the YAML","Review the YAML when copying commands between profiles"],"tags":["configuration","cassandra-stress","yaml"],"backgroundTag":"resource-not-found","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"}