Skip to content

[Enhancement]: Add robust error handling and retry logic to CouchbaseVectorStore search operations #33

@Igosain08

Description

@Igosain08

Currently, CouchbaseVectorStore makes direct calls to the Couchbase Search service without internal exception handling. In production environments, transient issues (e.g., AmbiguousTimeoutException) or state issues (e.g., IndexNotFoundException during a rebalance) cause the entire RAG chain to fail.

Proposed Solution

I suggest wrapping the internal _search calls within similarity_search_with_score_by_vector with a custom retry/exception handler.

Logic Flow:

  1. Try the search operation.
  2. Except AmbiguousTimeoutException, ServiceUnavailableException: Implement a simple exponential backoff retry (e.g., 3 attempts).
  3. Except IndexNotFoundException:
    • Log a logger.warning stating the index is not yet ready.
    • Return an empty list [] to allow the RAG chain to continue without crashing.
  4. Except CouchbaseException: Log the specific internal error and re-raise as a standard RuntimeError (or a LangChain-native exception). This ensures that Couchbase-specific SDK details do not leak into the application layer for developers using the general VectorStore interface.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions