apache/cassandra · error · SyntaxException

Invalid value for property

Error message

Invalid value for property '%s'. It should be a set of identifiers.

What it means

PropertyDefinitions.getQualifiedNames() fetches a WITH-clause property that must be a Set<QualifiedName>. Since an empty map and empty set parse ambiguously, empty maps are tolerated as empty sets, but any other non-Set value triggers a SyntaxException stating the value must be a set of identifiers.

Solutions

  1. Rewrite the property value as a parenthesized set of identifiers: option = (id1, id2).
  2. If the value should be empty, ensure it parses as an empty set/map and check how your tool serializes it.
  3. Fix the query builder to emit Set<QualifiedName> values for such properties.

Example fix

-- before
CREATE TABLE t (...) WITH option = 'col1'; -- string, not a set
-- after
CREATE TABLE t (...) WITH option = (col1);
Defensive patterns

Strategy: type-guard

Validate before calling

Object v = options.get(name); if (v != null && !(v instanceof Set) && !(v instanceof Map)) throw new IllegalArgumentException(name + " must be a set of identifiers");

Type guard

boolean isSetOfIdentifiers(Object v) { return v == null || (v instanceof Map && ((Map<?,?>) v).isEmpty()) || v instanceof Set; }

Try / catch

try { session.execute(ddl); } catch (SyntaxException e) { if (e.getMessage().contains("set of identifiers")) { /* wrap value in parentheses */ } else throw e; }

Prevention

When it happens

Trigger: Supplying a scalar, string, or map value for a property expected to be a set of identifiers (e.g. collection options on CREATE TABLE like CLUSTERING ORDER-related identifier sets).

Common situations: Parenthesization errors: writing option = 'id' instead of option = (id); query builders emitting the wrong literal shape; ambiguous empty value handling.

Related errors


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

Appendix: source

Thrown at src/java/org/apache/cassandra/cql3/statements/PropertyDefinitions.java:101

    {
        Object val = properties.get(name);
        if (val == null)
            return null;
        if (!(val instanceof String))
            throw new SyntaxException(format("Invalid value for property '%s'. It should be a string", name));
        return (String)val;
    }

    @Nullable
    public Set<QualifiedName> getQualifiedNames(String name) throws SyntaxException
    {
        Object val = properties.get(name);
        if (val == null)
            return null;
        if (val instanceof Map && ((Map<?, ?>)val).isEmpty()) // to solve the ambiguity between empty map and empty set
            return Collections.emptySet();
        if (!(val instanceof Set))
            throw new SyntaxException(String.format("Invalid value for property '%s'. It should be a set of identifiers.", name));
        return (Set<QualifiedName>) val;
    }

    @Nullable
    protected Map<String, String> getMap(String name) throws SyntaxException
    {
        Object val = properties.get(name);
        if (val == null)
            return null;
        if (val instanceof Set && ((Set<?>)val).isEmpty()) // to solve the ambiguity between empty map and empty set
            return Collections.emptyMap();
        if (!(val instanceof Map))
            throw new SyntaxException(format("Invalid value for property '%s'. It should be a map.", name));
        return (Map<String, String>)val;
    }

    public boolean getBoolean(String key, boolean defaultValue) throws SyntaxException
    {

View on GitHub (pinned to 88fd0f6a0e)