Couchbase Python - Function build_deferred_indexes not working correctly

Code snippet as follows:

from couchbase.cluster import Cluster
from couchbase.auth import PasswordAuthenticator

cluster = Cluster("localhost", PasswordAuthenticator("username", "password") )
index_manager = cluster.query_indexes()
index_manager.build_deferred_indexes("bucket-name")

This is working correctly when there are deferred indexes in the database, but throwing an error when there are no deferred indexes:

couchbase.exceptions.QueryIndexNotFoundException: <RC=0xDA[LCB_ERR_INDEX_NOT_FOUND (218)], HTTP Request failed. Examine 'objextra' for full result, inner_cause=<RC=0x12D[LCB_ERR_DOCUMENT_NOT_FOUND (301)], HTTP Request failed. Examine 'objextra' for full result, Results=1, C Source=(src/pycbc_http.c,212), OBJ=ViewResult<rc=0x12D[LCB_ERR_DOCUMENT_NOT_FOUND (301)], value={'requestID': 'ccf14896-78df-4dea-9f1d-3122f018ceeb', 'clientContextID': '9c73d8c43ee23146', 'signature': {'*': '*'}, 'results': [], 'status': 'success', 'metrics': {'elapsedTime': '13.258991ms', 'executionTime': '13.227582ms', 'resultCount': 33, 'resultSize': 17704, 'sortCount': 33}}, http_status=0, tracing_context=0, tracing_output=None>, Tracing Output={":nokey:0": null}>, OBJ=ViewResult<rc=0x12D[LCB_ERR_DOCUMENT_NOT_FOUND (301)], value={'requestID': 'ccf14896-78df-4dea-9f1d-3122f018ceeb', 'clientContextID': '9c73d8c43ee23146', 'signature': {'*': '*'}, 'results': [], 'status': 'success', 'metrics': {'elapsedTime': '13.258991ms', 'executionTime': '13.227582ms', 'resultCount': 33, 'resultSize': 17704, 'sortCount': 33}}, http_status=0, tracing_context=0, tracing_output=None>>

Expectation: The function should not throw an error for this. If this behaviour was built for a particular reason, have an option in the function like ignore_missing which when set to True should not throw this error.

Current workaround:

try:
    index_manager.build_deferred_indexes("bucket_name")
except QueryIndexNotFoundException:
    pass

Thanks @Gautam_Singhania, can you also let us know which version of the SDK are you using ?

That is a completely reasonable thing to add to the BuildDeferredIndexOptions. Can you create a bug for this on our Jira? LMK if you would rather not, and I will. Thx!

@AV25242 Version 3.0.8
@davidkelly I have created a bug, but not sure if you need more details on this. Can you please review https://issues.couchbase.com/browse/PYCBC-1088 . Thanks!!