{"record":{"id":"c707b3414de5f93a","repo":"apache/pulsar","slug":"concurrent-modification-c707b3","errorCode":null,"errorMessage":"Concurrent modification","messagePattern":"Concurrent modification","errorType":"http","errorClass":"RestException","httpStatus":409,"severity":"error","filePath":"pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java","lineNumber":258,"sourceCode":"                            .log(\"Successfully granted access for role on topic\"))\n                    .exceptionally(ex -> {\n                        Throwable realCause = FutureUtil.unwrapCompletionException(ex);\n                        //The IllegalArgumentException and the IllegalStateException were historically thrown by the\n                        // grantPermissionAsync method, so we catch them here to ensure backwards compatibility.\n                        if (realCause instanceof MetadataStoreException.NotFoundException\n                                || realCause instanceof IllegalArgumentException) {\n                            log.warn()\n                                    .attr(\"topic\", topicUri)\n                                    .exception(realCause)\n                                    .log(\"Failed to set permissions for topic: Namespace does not exist\");\n                            throw new RestException(Status.NOT_FOUND, \"Topic's namespace does not exist\");\n                        } else if (realCause instanceof MetadataStoreException.BadVersionException\n                                || realCause instanceof IllegalStateException) {\n                            log.warn()\n                                    .attr(\"topic\", topicUri)\n                                    .exceptionMessage(realCause)\n                                    .log(\"Failed to set permissions for topic\");\n                            throw new RestException(Status.CONFLICT, \"Concurrent modification\");\n                        } else {\n                            log.error()\n                                    .attr(\"topic\", topicUri)\n                                    .exceptionMessage(realCause)\n                                    .log(\"Failed to get permissions for topic\");\n                            throw new RestException(realCause);\n                        }\n                    });\n        } else {\n            String msg = \"Authorization is not enabled\";\n            return FutureUtil.failedFuture(new RestException(Status.NOT_IMPLEMENTED, msg));\n        }\n    }\n\n    protected void internalGrantPermissionsOnTopic(final AsyncResponse asyncResponse, String role,\n                                                   Set<AuthAction> actions) {\n        // This operation should be reading from zookeeper and it should be allowed without having admin privileges\n        CompletableFuture<Void> validateAccessForTenantCf = validateAdminAccessForTenantAsync(namespaceName.getTenant())","sourceCodeStart":240,"sourceCodeEnd":276,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java#L240-L276","documentation":"grantPermissionsAsync detected a concurrent modification of the topic's authorization policies while writing to the metadata store (e.g., a NotFound or IllegalState race); historically mapped from grantPermissionAsync failures to keep client compatibility.","triggerScenarios":"Thrown at pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java:258 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the grant — the conflict is typically transient","Serialize concurrent permission changes on the same topic"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"820761864ed8e2a7d2e52dd9763ad2ae117c1395","analyzedAt":"2026-09-06T00:14:20.138Z","contentChangedAt":"2026-09-06T00:14:20.138Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}