apache/cassandra · error · IllegalArgumentException

Op name contains an invalid profile specname

Error message

Op name %s contains an invalid profile specname: %s

What it means

In the 'user' command, op names can be qualified as <profilename>.<op> to select operations from a specific loaded profile. When the qualifier before the dot doesn't match any loaded profile's specName, get() throws this IllegalArgumentException naming the op and the unrecognized profile name.

Solutions

  1. Use the exact specName from the YAML (keys.table) as the qualifier: ops(ks1.t1.insert=1).
  2. Drop the qualifier to use the default profile: ops(insert=1).
  3. Print/inspect specName in the YAML header and keep ops() arguments in sync with it.
  4. Verify all profile= files were loaded (an earlier file-not-found may have removed the expected profile).

Example fix

// before (YAML declares keyspace: ks1, table: t1)
cassandra-stress user profile=p.yaml ops(myp.insert=1)
// after
cassandra-stress user profile=p.yaml ops(ks1.t1.insert=1)
Defensive patterns

Strategy: validation

Validate before calling

String specName = yamlSpecName(profileFile); // keys.table from YAML header
for (String op : opNames) { if (op.contains(".") && !op.startsWith(specName + ".")) throw new IllegalArgumentException("op qualifier must be " + specName); }

Try / catch

try { /* build op distribution */ } catch (IllegalArgumentException e) { if (e.getMessage().contains("invalid profile specname")) { System.err.println("Use the YAML specName (keyspace.table) as qualifier"); } throw e; }

Prevention

When it happens

Trigger: Running 'cassandra-stress user profile=p.yaml ops(myprofile.insert=1)' where 'myprofile' is not the specName declared in the YAML (or no profile was loaded with that name); using a dot-qualified op name when the profile map only contains a different key.

Common situations: Using the filename (p.yaml) or table shorthand instead of the YAML's specName; editing the keyspace/table in the YAML after writing the ops() list; forgetting that unqualified names resolve to the default (first) profile but qualified names must match exactly.

Related errors


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

Appendix: source

Thrown at tools/stress/src/org/apache/cassandra/stress/settings/SettingsCommandUser.java:135

            protected List<? extends Operation> get(Timer timer, String key, boolean isWarmup)
            {
                Matcher m = EXTRACT_SPEC_CMD.matcher(key);
                final String profile_name;
                final String sub_key;
                if (m.matches())
                {
                    profile_name = m.group(1);
                    sub_key = m.group(2);
                }
                else
                {
                    profile_name = default_profile_name;
                    sub_key = key;
                }

                if (!profiles.containsKey(profile_name))
                {
                    throw new IllegalArgumentException(String.format("Op name %s contains an invalid profile specname: %s", key, profile_name));
                }
                StressProfile profile = profiles.get(profile_name);
                TokenRangeIterator tokenRangeIterator = tokenRangeIterators.get(profile_name);
                PartitionGenerator generator = profile.newGenerator(settings);
                if (sub_key.equalsIgnoreCase("insert"))
                    return Collections.singletonList(profile.getInsert(timer, generator, seeds, settings));
                if (sub_key.equalsIgnoreCase("validate"))
                    return profile.getValidate(timer, generator, seeds, settings);

                if (profile.tokenRangeQueries.containsKey(sub_key))
                    return Collections.singletonList(profile.getBulkReadQueries(sub_key, timer, settings, tokenRangeIterator, isWarmup));

                return Collections.singletonList(profile.getQuery(sub_key, timer, generator, seeds, settings, isWarmup));
            }
        };
    }

    public void truncateTables(StressSettings settings)

View on GitHub (pinned to 88fd0f6a0e)