Python SDK 3.0 Sample Code results in issues on query

the starter Code form Python SDK Docs throw an error for an “open Bucket” and Network Exceptions.

from couchbase.cluster import Cluster, ClusterOptions, QueryOptions
from couchbase_core.cluster import PasswordAuthenticator

cluster = Cluster('couchbase://', ClusterOptions(PasswordAuthenticator('username', 'password')))
cb = cluster.bucket('app')
cb_coll = cb.default_collection()


row_iter = cluster.query('SELECT name FROM app WHERE $1 IN interests', QueryOptions(positional_parameters=['African Swallows']))
for row in row_iter: print(row)

Error :

Traceback (most recent call last):
  File "/home/vm/", line 10, in <module>
    row_iter = cluster.query('SELECT name FROM app WHERE $1 IN interests', QueryOptions(positional_parameters=['African Swallows']))
  File "/home/vm/.local/lib/python3.6/site-packages/couchbase/", line 609, in query
    err_msg="Query requires an open bucket")
  File "/home/vm/.local/lib/python3.6/site-packages/couchbase/", line 624, in _maybe_operate_on_an_open_bucket
    if self._is_6_5_plus():
  File "/home/vm/.local/lib/python3.6/site-packages/couchbase/", line 555, in _is_6_5_plus
    response = self._admin.http_request(path="/pools").value
  File "/home/vm/.local/lib/python3.6/site-packages/couchbase/management/", line 165, in http_request
couchbase.exceptions.TimeoutException: <Key='/pools', RC=0xC9[LCB_ERR_TIMEOUT (201)], HTTP Request failed. Examine 'objextra' for full result, Results=1, C Source=(src/pycbc_http.c,212), OBJ=HttpResult<rc=0xC9[LCB_ERR_TIMEOUT (201)], value=None, http_status=0, url=/pools, tracing_context=0, tracing_output=None>, Context={'response_code': 0, 'path': '/pools', 'response_body': '', 'endpoint': '', 'type': 'HTTPErrorContext'}, Tracing Output={":nokey:0": null}>

I read the python SDK docs for this but didnt find anything which can help to solve this error.
The Document already exists in bucket on Server. Also i cant use CRUD operations.
Whats causing this?

ubuntu 18 64-bit
Python 3.6.9
Couchbase Server 6.5 CE
Python SDK 3.0

Also if im creating an index while the script

Could someone point me out how to solved it or any Docs that can work.
thank you

Hi, looks like a connectivity issue on the Admin port - we fixed an issue similar to this recently. Are you using the latest SDK (3.0.3)?

If you have upgraded to 3.0.3 and this still happens, please could you collect libcouchbase logs as described here:

You will also need to set LCB_LOGLEVEL to greater than 0 - I would suggest 5:

export LCB_LOGLEVEL=5 # for POSIX
set LCB_LOGLEVLEL=5 # for Windows

yes im using couchbase 3.0.3 installed by pip

OK - please try the diagnostics as described above. Thanks!

This may be due to bootstrapping for services taking longer than for KV. We are working on a solution to this (Cluster.wait_until_ready), but in the meantime, could you attempt to retry the query operation a few times, like so? # 60 seconds is an example, but should be more than enough time
while True:
    except TimeoutException:
        time.sleep(5) # don't hammer the server too hard

Cluster.wait_until_ready should simplify this. We chose to expose the asynchronous nature of connection for SDK3, as in practice connections may drop, so it is always a good idea to handle the possibility that the server might not be up.

Sorry but this solution is not working the connection does happen to the server but the query results in TimeoutException , also

  1. why does the query throws an err_msg="Query requires an open bucket"
  2. Is there a way to configure the ports in sdk 3