apache/cassandra · error · IllegalStateException
Do not specify additional arguments when --category/-c is se
Error message
Do not specify additional arguments when --category/-c is set.
What it means
nodetool guardrails-config set/display rejects combining the --category/-c option with an additional positional guardrail-name argument, throwing IllegalStateException. The two ways of scoping output are exclusive: either a category or a specific guardrail.
Source
Thrown at src/java/org/apache/cassandra/tools/nodetool/GuardrailsConfigCommand.java:74
@Command(name = "getguardrailsconfig", description = "Print runtime configuration of guardrails.")
public static class GetGuardrailsConfig extends GuardrailsConfigCommand
{
@Option(names = { "--category", "-c" },
description = "Category of guardrails to filter, can be one of 'values', 'thresholds', 'flags', 'others'.")
private GuardrailCategory guardrailCategory;
@Option(names = { "--expand" },
description = "Expand all guardrail names so they reflect their counterparts in cassandra.yaml")
private boolean expand = false;
@Parameters(index = "0", arity = "0..1", description = "Specific name of a guardrail to get configuration of or all guardrails if not specified.")
private String guardrailName;
@Override
public void execute(NodeProbe probe)
{
if (guardrailName != null && guardrailCategory != null)
throw new IllegalStateException("Do not specify additional arguments when --category/-c is set.");
Map<String, List<Method>> allGetters = parseGuardrailNames(probe.getGuardrailsMBean().getClass().getDeclaredMethods(), guardrailName);
if (allGetters.isEmpty())
{
assert guardrailName != null;
throw new IllegalStateException(format("Guardrail %s not found.", guardrailName));
}
display(probe, allGetters, guardrailCategory, expand);
}
@VisibleForTesting
public static Map<String, List<Method>> parseGuardrailNames(Method[] guardrailsMethods, String guardrailName)
{
Map<String, List<Method>> allGetters = stream(guardrailsMethods)
.filter(method -> method.getName().startsWith("get")
&& !method.getName().endsWith("CSV")View on GitHub (pinned to 88fd0f6a0e)
Solutions
- Remove the positional guardrail name and use only --category/-c.
- Remove --category/-c and query the single guardrail by name.
- Run `nodetool help guardrails-config` to see accepted argument shapes.
Example fix
// before nodetool guardrailsconfig get --category read consistency // after nodetool guardrailsconfig get --category read
Defensive patterns
Strategy: validation
Validate before calling
def validate_guardrails_args(category, name):
if category and name:
raise SystemExit('Use either --category/-c or a guardrail name, not both.') Try / catch
try {
displayGuardrails(...);
} catch (IllegalStateException e) {
System.err.println(e.getMessage() + " — drop either --category or the positional name.");
} Prevention
- Choose one scoping mechanism per invocation.
- Don't blanket-add both filters in wrapper scripts.
When it happens
Trigger: Running e.g. `nodetool guardrailsconfig --category read myguardrail` — both a guardrail name argument and a category flag are supplied.
Common situations: Appending a guardrail name out of habit while a category flag is already present; scripting tools that add both filters unconditionally.
Related errors
- Guardrail %s not found.
- Unhandled return type:
- No arguments.
- Error occured when setting the config for setter %s with arg
- %s is expecting %d argument values. Getting %d instead.
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/b9186304253f8c61.
Report an issue: GitHub.