Unpredictable Connection Aborted Errors

urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "/src/Embedding/EmbeddingPredictor.py", line 90, in predict

    self.embedding_handler.put_batch("", vectors)

  File "/src/Embedding/ApiHandler/EmbeddingHandler.py", line 186, in put_batch
    response = self.index.upsert(

  File "/venv/lib/python3.9/site-packages/pinecone/core/utils/error_handling.py", line 25, in inner_func

    raise PineconeProtocolError(f'Failed to connect; did you specify the correct index name?') from e

pinecone.core.exceptions.PineconeProtocolError: Failed to connect; did you specify the correct index name?

Using the same index object, I get these errors every once in a while. I know its the correct index because I do have some successful calls.

Hi @PineconeLover123,

Check that you’re using the latest version of the Python client, 2.2.1. It has some improved retry logic to handle these scenarios. If you’re already using that version, I’d recommend adding some try logic to your query wrapper to re-initiate the index connection periodically. It’s likely the connection is dying due to timeouts, but initiating a new connection via pinecone.Index("your_index") should help.

Also, I recommend you consider using the client’s gRPC version, as it is far faster and more robust than the REST version.