apache/cassandra · error · IllegalArgumentException

No bulk read query defined with name

Error message

No bulk read query defined with name ${name}

What it means

getBulkReadQueries looks up a token-range (bulk read) query definition by name from the profile YAML. If no TokenRangeQueryDef exists under that name, an IllegalArgumentException is thrown. Bulk read queries must be explicitly declared in the profile.

Solutions

  1. Define the token-range query in the profile YAML under the correct section
  2. Fix the name typo in the operation invocation
  3. Use a query name that exists in the profile (check the YAML)
  4. Use a profile that supports bulk reads if that is the intent

Example fix

# before
stress read profile=p.yaml op=bulkread
# after (yaml defines tokenrangequery 'scan1')
stress read profile=p.yaml op=scan1
Defensive patterns

Strategy: validation

Validate before calling

if (!yamlProfile.getTokenRangeQueries().containsKey(name)) throw new IllegalArgumentException("unknown bulk read query: " + name);

Try / catch

try { profile.getBulkReadQueries(name, ...); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith("No bulk read query defined")) log.error("Define token-range query '{}' in profile YAML", name); throw e; }

Prevention

When it happens

Trigger: Calling profile.getBulkReadQueries(name, ...) with a name not present in the tokenRangeQueries map built from the YAML's token-range query definitions.

Common situations: Typos in the bulk read query name, running a bulk-read operation against a profile that defines no token range queries, copying commands between profiles.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/697e01b224b1b6ce. Report an issue: GitHub.

Appendix: source

Thrown at tools/stress/src/org/apache/cassandra/stress/StressProfile.java:471

            throw new IllegalArgumentException("could not parse update query:" + statement.getQueryString(), e);
        }

        /*
         * here we differentiate between static vs dynamic conditions:
         *  - static condition example: if col1 = NULL
         *  - dynamic condition example: if col1 = ?
         *  for static condition we don't have to replace value, no extra work involved.
         *  for dynamic condition we have to read existing db value and then
         *  use current db values during the update.
         */
        return modificationStatement.getConditions().stream().anyMatch(ColumnCondition.Raw::containsBindMarkers);
    }

    public Operation getBulkReadQueries(String name, Timer timer, StressSettings settings, TokenRangeIterator tokenRangeIterator, boolean isWarmup)
    {
        StressYaml.TokenRangeQueryDef def = tokenRangeQueries.get(name);
        if (def == null)
            throw new IllegalArgumentException("No bulk read query defined with name " + name);

        return new TokenRangeQuery(timer, settings, tableMetaData, tokenRangeIterator, def, isWarmup);
    }


    public PartitionGenerator getOfflineGenerator()
    {
        org.apache.cassandra.schema.TableMetadata metadata = CreateTableStatement.parse(tableCql, keyspaceName).build();

        //Add missing column configs
        Iterator<ColumnMetadata> it = metadata.allColumnsInSelectOrder();
        while (it.hasNext())
        {
            ColumnMetadata c = it.next();
            if (!columnConfigs.containsKey(c.name.toString()))
                columnConfigs.put(c.name.toString(), new GeneratorConfig(seedStr + c.name.toString(), null, null, null));
        }

View on GitHub (pinned to 88fd0f6a0e)