apache/cassandra · error · IllegalStateException

Error occured when setting the config for setter %s with arg

Error message

Error occured when setting the config for setter %s with arguments %s: %s

What it means

When invoking a guardrail setter fails, the set subcommand wraps the underlying exception's cause message into IllegalStateException 'Error occured when setting the config for setter <name> with arguments <args>: <reason>'. The reason is the actual server-side failure (e.g. value rejected by the guardrail setter).

Source

Thrown at src/java/org/apache/cassandra/tools/nodetool/GuardrailsConfigCommand.java:222

                                                .orElseThrow(() -> new IllegalStateException(format("Guardrail %s not found.", snakeCaseName)));

            sanitizeArguments(setter, args);
            validateArguments(setter, snakeCaseName, args);

            List<String> methodArgs = args.subList(1, args.size());
            try
            {
                setter.invoke(probe.getGuardrailsMBean(), prepareArguments(methodArgs, setter));
            }
            catch (Exception ex)
            {
                String reason;
                if (ex.getCause() != null && ex.getCause().getMessage() != null)
                    reason = ex.getCause().getMessage();
                else
                    reason = ex.getMessage();

                throw new IllegalStateException(format("Error occured when setting the config for setter %s with arguments %s: %s",
                                                       snakeCaseName, methodArgs, reason));
            }
        }

        @Override
        public void addRow(List<InternalRow> bucket, GuardrailsMBean mBean, List<Method> methods, String guardrailName) throws Throwable
        {
            if (methods.size() == 1)
            {
                Method method = methods.get(0);
                if (method.getParameterTypes().length == 1)
                    constructRow(bucket, sanitizeSetterName(method), method.getParameterTypes()[0].getName());
                else
                    constructRow(bucket, sanitizeSetterName(method), stream(method.getParameterTypes()).map(Class::getName).collect(toList()).toString());
            }
        }

        private Map<String, List<Method>> getAllSetters(NodeProbe probe)

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Read the embedded reason in the message and fix the offending value.
  2. Validate the value against the guardrail's documented constraints in cassandra.yaml/docs.
  3. Confirm the setter exists and its parameter types in the matching Cassandra version.

Example fix

// before
nodetool guardrailsconfig set read_consistency_level BOGUS
// after
nodetool guardrailsconfig set read_consistency_level EACH_QUORUM
Defensive patterns

Strategy: try-catch

Try / catch

try:
    run(['nodetool','guardrailsconfig','set',name]+values)
except subprocess.CalledProcessError as e:
    # stderr contains 'Error occured when setting the config for setter ...: <reason>'
    sys.exit(f'setting guardrail {name} failed: {e.stderr.split(": ")[-1]}')

Prevention

When it happens

Trigger: Calling `nodetool guardrailsconfig set <name> <values>` where the reflective MBean setter call throws — e.g. an invalid value, wrong value type, or guardrail constraint violation on the server.

Common situations: Passing a value the setter rejects (out-of-range, malformed set syntax); wrong number/format of values; guardrail disabled or removed on the server.

Understand the failure class

Background: "API request failed": what wrapped HTTP errors from external APIs mean and how to find the real cause — this error's family across 29 libraries.

Related errors


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