apache/cassandra · error · UnsupportedOperationException

GRANT operation is not supported by AllowAllAuthorizer

Error message

GRANT operation is not supported by AllowAllAuthorizer

What it means

Thrown by CreateTypeStatement.apply when the target keyspace already contains a user-defined type with the requested name and the statement did not include IF NOT EXISTS. Cassandra type names must be unique within a keyspace, so a conflicting definition is rejected rather than silently overwritten or merged.

Source

Thrown at src/java/org/apache/cassandra/auth/AllowAllAuthorizer.java:38

import java.util.Collections;
import java.util.Set;

public class AllowAllAuthorizer implements IAuthorizer
{
    @Override
    public boolean requireAuthorization()
    {
        return false;
    }

    public Set<Permission> authorize(AuthenticatedUser user, IResource resource)
    {
        return resource.applicablePermissions();
    }

    public Set<Permission> grant(AuthenticatedUser performer, Set<Permission> permissions, IResource resource, RoleResource to)
    {
        throw new UnsupportedOperationException("GRANT operation is not supported by AllowAllAuthorizer");
    }

    public Set<Permission> revoke(AuthenticatedUser performer, Set<Permission> permissions, IResource resource, RoleResource from)
    {
        throw new UnsupportedOperationException("REVOKE operation is not supported by AllowAllAuthorizer");
    }

    public void revokeAllFrom(RoleResource droppedRole)
    {
    }

    public void revokeAllOn(IResource droppedResource)
    {
    }

    public Set<PermissionDetails> list(AuthenticatedUser performer, Set<Permission> permissions, IResource resource, RoleResource of)
    {
        throw new UnsupportedOperationException("LIST PERMISSIONS operation is not supported by AllowAllAuthorizer");

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Use 'CREATE TYPE IF NOT EXISTS ks.name (...)' to make the statement idempotent.
  2. Check the existing definition with 'DESCRIBE TYPE ks.name' (or system_schema.types) and reuse it instead of recreating.
  3. If a different definition is genuinely needed, DROP TYPE ks.name first (ensuring no tables reference it) and then create the new one.
  4. Rename the new type to avoid the collision.

Example fix

// before
CREATE TYPE orders.address (street text, city text);
// after
CREATE TYPE IF NOT EXISTS orders.address (street text, city text);
Defensive patterns

Strategy: validation

Validate before calling

boolean exists = session.execute("SELECT type_name FROM system_schema.types WHERE keyspace_name = ? AND type_name = ?", ks, typeName).one() != null;
if (exists && !ifNotExists) skipOrFail();

Try / catch

try {
    session.execute(stmt);
} catch (InvalidQueryException e) {
    if (e.getMessage().contains("already exists")) { /* treat as success for idempotent migrations */ }
    else throw e;
}

Prevention

When it happens

Trigger: Executing 'CREATE TYPE ks.name (...)' when ks.name already exists as a UDT and no IF NOT EXISTS clause is present; re-running an idempotent schema migration script without the IF NOT EXISTS guard.

Common situations: Migration/bootstrap scripts executed more than once; two teams independently defining a type with the same name in one keyspace; re-running a CQL file after a partial failure where the type was already created.

Understand the failure class

Background: "already exists" / EEXIST / FileAlreadyExistsException: what the 'file already exists' error means and how to fix it — this error's family across 37 libraries.

Related errors


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