{"record":{"id":"cc36f317cf6a245c","repo":"apache/cassandra","slug":"grant-operation-is-not-supported-by-allowallauthor","errorCode":null,"errorMessage":"GRANT operation is not supported by AllowAllAuthorizer","messagePattern":"GRANT operation is not supported by AllowAllAuthorizer","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/auth/AllowAllAuthorizer.java","lineNumber":38,"sourceCode":"import java.util.Collections;\nimport java.util.Set;\n\npublic class AllowAllAuthorizer implements IAuthorizer\n{\n    @Override\n    public boolean requireAuthorization()\n    {\n        return false;\n    }\n\n    public Set<Permission> authorize(AuthenticatedUser user, IResource resource)\n    {\n        return resource.applicablePermissions();\n    }\n\n    public Set<Permission> grant(AuthenticatedUser performer, Set<Permission> permissions, IResource resource, RoleResource to)\n    {\n        throw new UnsupportedOperationException(\"GRANT operation is not supported by AllowAllAuthorizer\");\n    }\n\n    public Set<Permission> revoke(AuthenticatedUser performer, Set<Permission> permissions, IResource resource, RoleResource from)\n    {\n        throw new UnsupportedOperationException(\"REVOKE operation is not supported by AllowAllAuthorizer\");\n    }\n\n    public void revokeAllFrom(RoleResource droppedRole)\n    {\n    }\n\n    public void revokeAllOn(IResource droppedResource)\n    {\n    }\n\n    public Set<PermissionDetails> list(AuthenticatedUser performer, Set<Permission> permissions, IResource resource, RoleResource of)\n    {\n        throw new UnsupportedOperationException(\"LIST PERMISSIONS operation is not supported by AllowAllAuthorizer\");","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/auth/AllowAllAuthorizer.java#L20-L56","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Use 'CREATE TYPE IF NOT EXISTS ks.name (...)' to make the statement idempotent.","Check the existing definition with 'DESCRIBE TYPE ks.name' (or system_schema.types) and reuse it instead of recreating.","If a different definition is genuinely needed, DROP TYPE ks.name first (ensuring no tables reference it) and then create the new one.","Rename the new type to avoid the collision."],"exampleFix":"// before\nCREATE TYPE orders.address (street text, city text);\n// after\nCREATE TYPE IF NOT EXISTS orders.address (street text, city text);","handlingStrategy":"validation","validationCode":"boolean exists = session.execute(\"SELECT type_name FROM system_schema.types WHERE keyspace_name = ? AND type_name = ?\", ks, typeName).one() != null;\nif (exists && !ifNotExists) skipOrFail();","typeGuard":null,"tryCatchPattern":"try {\n    session.execute(stmt);\n} catch (InvalidQueryException e) {\n    if (e.getMessage().contains(\"already exists\")) { /* treat as success for idempotent migrations */ }\n    else throw e;\n}","preventionTips":["Use IF NOT EXISTS for all idempotent DDL scripts.","Make migrations track applied statements (schema migration tooling).","Verify existing type definitions before redefining them."],"tags":["cassandra","cql","ddl","user-type","name-conflict"],"backgroundTag":"file-already-exists","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}