How to know if Bucket-Instance can be used? (after Couchbase restart)


I was wondering how someone can know if a Bucket-Instance can be used or not. The reason is that I realized that in my local test environment (with one Couchbase-Node) it causes problems when I restart the Couchbase-Server. The Node.js-Application displays then this error after I try to use an existing Bucket-Instance:

CouchbaseError: Generic network failure. Enable detailed error codes (via LCB_CNTL_DETAILED_ERRCODES, or via `detailed_errcodes` in the connection string) and/or enable logging to get more information

Somehow do not find a proper way to test for it. The Bucket-Instance has the property “connected” but that is true and stays true even after I get the error. Getting a proper error does also not work for me. Even if I add “?detailed_errcodes=1” to the connection-string I still just get the above error-message.

I have a method to get a Bucket-Instance before doing any operation. It simply returns an existing one in the case I created one before and the “connected” property is true. Which because of the above problem does not work after a Couchbase-Server restart.

So what is the correct and proper way to do that? Could sadly not find anything. Should not at least the “connected” property change to false after the error so that I can simply check for that, to then create a new Bucket-Instance?


The connected property actually means “bootstrapped”, in the sense that the instance has been connected to the cluster and is aware of its topology (and most importantly, is able to start receiving operations).

Restarting Couchbase Server may take some time, allow up to a minute for the client to recover.

NETWORK_ERROR is thrown by the underlying C library when an error code is received from the operating system which doen’t match a known error code (Which it would then map to a libcouchbase one). Most likely you are getting a “new” error code. Enable logging (LCB_LOGLEVEL=5 in your environment; see which might give you some more insight (For example, the actual OS/UV code being received).