Unable to Add User using clusterAadmin.upsertUser(UserSettings)


Version: 4.6.2-3905 Enterprise Edition (build-3905)
Java SDK as follows:


I am puzzled why I can’t create a new User with code as follows and I am connecting with the Administrator username and password running a single server on my Mac BUT I am getting error “Could not update user: FAILURE, msg: Method Not Allowed” and I can’t seem to understand why I can’t perform this action?


        UserSettings userSettings = UserSettings.build()
                        // Roles required for the reading of data from
                        // the bucket.
                        new UserRole("bucket_admin", bucketName),
                        //new UserRole("cluster_admin"),
                        new UserRole("data_reader", "*"),
                        new UserRole("query_select", "*"),
                        // Roles required for the writing of data into
                        // the bucket.
                        new UserRole("data_writer", bucketName),
                        new UserRole("query_insert", bucketName),
                        new UserRole("query_delete", bucketName),
                        // Role required for the creation of indexes
                        // on the bucket.
                        new UserRole("query_manage_index", bucketName)));
        clusterManager.upsertUser(username, userSettings);

Error: Why am I not allowed to do this when I can create a Bucket without any issue?

com.couchbase.client.core.CouchbaseException: Could not update user: FAILURE, msg: Method Not Allowed

	at com.couchbase.client.java.cluster.DefaultAsyncClusterManager$18.call(DefaultAsyncClusterManager.java:329)

If I create a bucket that works fine, why is User creation failing?

        BucketSettings bucketSettings = new DefaultBucketSettings.Builder()
                .name(bucketName) // name of bucket to create
                .quota(120) // 120 megabytes


Current roles for the Admistrator user as follows:

$ couchbase-cli admin-role-manage -c localhost:8091 -u Administrator -p welcome1 --my-roles
SUCCESS: my roles:
  "id": "Administrator",
  "roles": [
      "role": "admin"


pasapicella@pas-macbook:~/pivotal/software/couchbase$ couchbase-cli admin-role-manage -c localhost:8091 -u Administrator -p welcome1 --get-roles
SUCCESS: user/role list:
    "id": "Administrator",
    "roles": [
        "role": "cluster_admin"
        "bucket_name": "*",
        "role": "bucket_admin"
        "bucket_name": "*",
        "role": "views_admin"

Hi @papicella,

You may want to try the latest Couchbase Java SDK 2.5.0, which was just released - https://developer.couchbase.com/server/other-products/release-notes-archives/java-sdk

If you’re still not having any luck, you may want to post to the Java SDK forum: https://www.couchbase.com/forums/c/java-sdk