apache/cassandra · warning · SyntaxException

Multiple definition for property '%s'

Error message

Multiple definition for property '%s'

What it means

RoleOptions is a per-statement map of IRoleManager.Option -> value used by CREATE ROLE/ALTER ROLE. setOption() refuses to set an option that is already present in the map, throwing SyntaxException so a single CQL statement can't define the same role property twice.

Source

Thrown at src/java/org/apache/cassandra/auth/RoleOptions.java:44

import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.exceptions.InvalidRequestException;
import org.apache.cassandra.exceptions.SyntaxException;
import org.apache.cassandra.utils.FBUtilities;

public class RoleOptions
{
    private final Map<IRoleManager.Option, Object> options = new HashMap<>();

    /**
     * Set a value for a specific option.
     * Throws SyntaxException if the same option is set multiple times
     * @param option
     * @param value
     */
    public void setOption(IRoleManager.Option option, Object value)
    {
        if (options.containsKey(option))
            throw new SyntaxException(String.format("Multiple definition for property '%s'", option.name()));
        options.put(option, value);
    }

    /**
     * Return true if there are no options with values set, false otherwise
     * @return whether any options have values set or not
     */
    public boolean isEmpty()
    {
        return options.isEmpty();
    }

    /**
     * Return a map of all the options which have been set
     * @return all options with values
     */
    public Map<IRoleManager.Option, Object> getOptions()
    {

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Deduplicate the options in the CQL statement — each WITH option may appear only once
  2. In query-builder code, use a map keyed by option so later sets overwrite instead of appending
  3. For changing an existing role's option, issue a second ALTER ROLE statement rather than repeating it in one

Example fix

// before
CREATE ROLE app WITH PASSWORD 'p' AND PASSWORD 'p2' AND LOGIN = true;
// after
CREATE ROLE app WITH PASSWORD 'p' AND LOGIN = true;
Defensive patterns

Strategy: validation

Validate before calling

Set<Option> seen = new HashSet<>(); for (Option o : opts) if (!seen.add(o)) fail("duplicate option: " + o);

Type guard

boolean optionsAreUnique(List<Option> opts) { return opts.stream().distinct().count() == opts.size(); }

Try / catch

try { session.execute(createRoleStmt); } catch (SyntaxException e) { if (e.getMessage().contains("Multiple definition")) dedupeAndRetry(); }

Prevention

When it happens

Trigger: CREATE ROLE x WITH PASSWORD 'a' AND PASSWORD 'b'; or ALTER ROLE ... WITH LOGIN = true AND LOGIN = false — the same option key appears more than once in one statement (often via combined option lists built programmatically).

Common situations: Tooling concatenating option lists (e.g. superuser + login + password) that accidentally includes an option twice; hand-written CQL repeating PASSWORD or LOGIN; DSL/query builders accumulating options across calls.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


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