System.ArgumentNullException when calling GetAllBucketsAsync()


I got the following error with simple two lines of code. What am I doing it wrong?

var cluster = await Cluster.ConnectAsync("couchbase://localhost", "username", "password");
var buckets = await cluster.Buckets.GetAllBucketsAsync();

But when I change from GetAllBucketsAsync() to query, it works perfectly.

var queryResult = await cluster.QueryAsync<dynamic>("select \"Hello World\" as greeting", new Couchbase.Query.QueryOptions());


Unhandled exception. System.ArgumentNullException: Value cannot be null. (Parameter 'value')
   at Newtonsoft.Json.Utilities.ValidationUtils.ArgumentNotNull(Object value, String parameterName)
   at Newtonsoft.Json.Linq.Extensions.Value[T,U](IEnumerable`1 value)
   at Newtonsoft.Json.Linq.Extensions.Value[U](IEnumerable`1 value)
   at Couchbase.Management.Buckets.BucketManager.GetBucketSettings(JToken json)
   at Couchbase.Management.Buckets.BucketManager.GetAllBucketsAsync(GetAllBucketsOptions options)
   at ConsoleApp.Program.Main(String[] args) in C:\AgodaGit\SEO\sitemap-generator\Agoda.Seo.SitemapGenerator\ConsoleApp\Program.cs:line 21
   at ConsoleApp.Program.<Main>(String[] args)


  • .NET Core 5
  • CouchbaseNetClient 3.1.3
  • Couchbase Server community-6.6.0
  • Runs on Docker (tried with Windows, same result error)

This appears to be a bug to me, @jmorris do you concur?

@thammarith Note that most applications wouldn’t use this particular API, it’s generally only used if you’re dealing with creating/editing buckets, it’s an administrative function. For general application purposes, you should use cluster.BucketAsync("bucket-name")


I believe it’s

1 Like