Problem uploading embeddings to my index. (index name is correct)

ConnectionResetError Traceback (most recent call last)
File /opt/homebrew/lib/python3.11/site-packages/urllib3/connectionpool.py:703, in HTTPConnectionPool.urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
702 # Make the request on the httplib connection object.
→ 703 httplib_response = self._make_request(
704 conn,
705 method,
706 url,
707 timeout=timeout_obj,
708 body=body,
709 headers=headers,
710 chunked=chunked,
711 )
713 # If we’re going to release the connection in finally:, then
714 # the response doesn’t need to know about the connection. Otherwise
715 # it will also try to release it and we’ll have a double-release
716 # mess.

File /opt/homebrew/lib/python3.11/site-packages/urllib3/connectionpool.py:386, in HTTPConnectionPool._make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
385 try:
→ 386 self._validate_conn(conn)
387 except (SocketTimeout, BaseSSLError) as e:
388 # Py2 raises this as a BaseSSLError, Py3 raises it as socket timeout.

File /opt/homebrew/lib/python3.11/site-packages/urllib3/connectionpool.py:1042, in HTTPSConnectionPool._validate_conn(self, conn)
1041 if not getattr(conn, “sock”, None): # AppEngine might not have .sock
→ 1042 conn.connect()
1044 if not conn.is_verified:

File /opt/homebrew/lib/python3.11/site-packages/urllib3/connection.py:419, in HTTPSConnection.connect(self)
417 context.load_default_certs()
→ 419 self.sock = ssl_wrap_socket(
420 sock=conn,
421 keyfile=self.key_file,
422 certfile=self.cert_file,
423 key_password=self.key_password,
424 ca_certs=self.ca_certs,
425 ca_cert_dir=self.ca_cert_dir,
426 ca_cert_data=self.ca_cert_data,
427 server_hostname=server_hostname,
428 ssl_context=context,
429 tls_in_tls=tls_in_tls,
430 )
432 # If we’re using all defaults and the connection
433 # is TLSv1 or TLSv1.1 we throw a DeprecationWarning
434 # for the host.

File /opt/homebrew/lib/python3.11/site-packages/urllib3/util/ssl_.py:449, in ssl_wrap_socket(sock, keyfile, certfile, cert_reqs, ca_certs, server_hostname, ssl_version, ciphers, ssl_context, ca_cert_dir, key_password, ca_cert_data, tls_in_tls)
448 if send_sni:
→ 449 ssl_sock = _ssl_wrap_socket_impl(
450 sock, context, tls_in_tls, server_hostname=server_hostname
451 )
452 else:

File /opt/homebrew/lib/python3.11/site-packages/urllib3/util/ssl_.py:493, in _ssl_wrap_socket_impl(sock, ssl_context, tls_in_tls, server_hostname)
492 if server_hostname:
→ 493 return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
494 else:

File /opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ssl.py:517, in SSLContext.wrap_socket(self, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, session)
511 def wrap_socket(self, sock, server_side=False,
512 do_handshake_on_connect=True,
513 suppress_ragged_eofs=True,
514 server_hostname=None, session=None):
515 # SSLSocket class handles server_hostname encoding before it calls
516 # ctx._wrap_socket()
→ 517 return self.sslsocket_class._create(
518 sock=sock,
519 server_side=server_side,
520 do_handshake_on_connect=do_handshake_on_connect,
521 suppress_ragged_eofs=suppress_ragged_eofs,
522 server_hostname=server_hostname,
523 context=self,
524 session=session
525 )

File /opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ssl.py:1075, in SSLSocket._create(cls, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, context, session)
1074 raise ValueError(“do_handshake_on_connect should not be specified for non-blocking sockets”)
→ 1075 self.do_handshake()
1076 except (OSError, ValueError):

File /opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ssl.py:1346, in SSLSocket.do_handshake(self, block)
1345 self.settimeout(None)
→ 1346 self._sslobj.do_handshake()
1347 finally:

ConnectionResetError: [Errno 54] Connection reset by peer

During handling of the above exception, another exception occurred:

ProtocolError Traceback (most recent call last)
File /opt/homebrew/lib/python3.11/site-packages/pinecone/core/utils/error_handling.py:17, in validate_and_convert_errors..inner_func(*args, **kwargs)
16 try:
—> 17 return func(*args, **kwargs)
18 except MaxRetryError as e:

File /opt/homebrew/lib/python3.11/site-packages/pinecone/index.py:449, in Index.query(self, vector, id, queries, top_k, namespace, filter, include_values, include_metadata, sparse_vector, **kwargs)
440 args_dict = self._parse_non_empty_args([(‘vector’, vector),
441 (‘id’, id),
442 (‘queries’, queries),
(…)
447 (‘include_metadata’, include_metadata),
448 (‘sparse_vector’, sparse_vector)])
→ 449 response = self._vector_api.query(
450 QueryRequest(
451 **args_dict,
452 _check_type=_check_type,
453 **{k: v for k, v in kwargs.items() if k not in _OPENAPI_ENDPOINT_PARAMS}
454 ),
455 **{k: v for k, v in kwargs.items() if k in _OPENAPI_ENDPOINT_PARAMS}
456 )
457 return parse_query_response(response, vector is not None or id)

File /opt/homebrew/lib/python3.11/site-packages/pinecone/core/client/api_client.py:776, in Endpoint.call(self, *args, **kwargs)
766 “”" This method is invoked when endpoints are called
767 Example:
768
(…)
774
775 “”"
→ 776 return self.callable(self, *args, **kwargs)

File /opt/homebrew/lib/python3.11/site-packages/pinecone/core/client/api/vector_operations_api.py:716, in VectorOperationsApi.init..__query(self, query_request, **kwargs)
714 kwargs[‘query_request’] =
715 query_request
→ 716 return self.call_with_http_info(**kwargs)

File /opt/homebrew/lib/python3.11/site-packages/pinecone/core/client/api_client.py:838, in Endpoint.call_with_http_info(self, **kwargs)
836 params[‘header’][‘Content-Type’] = header_list
→ 838 return self.api_client.call_api(
839 self.settings[‘endpoint_path’], self.settings[‘http_method’],
840 params[‘path’],
841 params[‘query’],
842 params[‘header’],
843 body=params[‘body’],
844 post_params=params[‘form’],
845 files=params[‘file’],
846 response_type=self.settings[‘response_type’],
847 auth_settings=self.settings[‘auth’],
848 async_req=kwargs[‘async_req’],
849 _check_type=kwargs[‘_check_return_type’],
850 _return_http_data_only=kwargs[‘_return_http_data_only’],
851 _preload_content=kwargs[‘_preload_content’],
852 _request_timeout=kwargs[‘_request_timeout’],
853 _host=_host,
854 collection_formats=params[‘collection_format’])

File /opt/homebrew/lib/python3.11/site-packages/pinecone/core/client/api_client.py:413, in ApiClient.call_api(self, resource_path, method, path_params, query_params, header_params, body, post_params, files, response_type, auth_settings, async_req, _return_http_data_only, collection_formats, _preload_content, _request_timeout, _host, _check_type)
412 if not async_req:
→ 413 return self.__call_api(resource_path, method,
414 path_params, query_params, header_params,
415 body, post_params, files,
416 response_type, auth_settings,
417 _return_http_data_only, collection_formats,
418 _preload_content, _request_timeout, _host,
419 _check_type)
421 return self.pool.apply_async(self.__call_api, (resource_path,
422 method, path_params,
423 query_params,
(…)
431 _request_timeout,
432 _host, _check_type))

File /opt/homebrew/lib/python3.11/site-packages/pinecone/core/client/api_client.py:200, in ApiClient.__call_api(self, resource_path, method, path_params, query_params, header_params, body, post_params, files, response_type, auth_settings, _return_http_data_only, collection_formats, _preload_content, _request_timeout, _host, _check_type)
198 try:
199 # perform request and return response
→ 200 response_data = self.request(
201 method, url, query_params=query_params, headers=header_params,
202 post_params=post_params, body=body,
203 _preload_content=_preload_content,
204 _request_timeout=_request_timeout)
205 except ApiException as e:

File /opt/homebrew/lib/python3.11/site-packages/pinecone/core/client/api_client.py:459, in ApiClient.request(self, method, url, query_params, headers, post_params, body, _preload_content, _request_timeout)
458 elif method == “POST”:
→ 459 return self.rest_client.POST(url,
460 query_params=query_params,
461 headers=headers,
462 post_params=post_params,
463 _preload_content=_preload_content,
464 _request_timeout=_request_timeout,
465 body=body)
466 elif method == “PUT”:

File /opt/homebrew/lib/python3.11/site-packages/pinecone/core/client/rest.py:271, in RESTClientObject.POST(self, url, headers, query_params, post_params, body, _preload_content, _request_timeout)
269 def POST(self, url, headers=None, query_params=None, post_params=None,
270 body=None, _preload_content=True, _request_timeout=None):
→ 271 return self.request(“POST”, url,
272 headers=headers,
273 query_params=query_params,
274 post_params=post_params,
275 _preload_content=_preload_content,
276 _request_timeout=_request_timeout,
277 body=body)

File /opt/homebrew/lib/python3.11/site-packages/pinecone/core/client/rest.py:157, in RESTClientObject.request(self, method, url, query_params, headers, body, post_params, _preload_content, _request_timeout)
156 request_body = json.dumps(body)
→ 157 r = self.pool_manager.request(
158 method, url,
159 body=request_body,
160 preload_content=_preload_content,
161 timeout=timeout,
162 headers=headers)
163 elif headers[‘Content-Type’] == ‘application/x-www-form-urlencoded’: # noqa: E501

File /opt/homebrew/lib/python3.11/site-packages/urllib3/request.py:78, in RequestMethods.request(self, method, url, fields, headers, **urlopen_kw)
77 else:
—> 78 return self.request_encode_body(
79 method, url, fields=fields, headers=headers, **urlopen_kw
80 )

File /opt/homebrew/lib/python3.11/site-packages/urllib3/request.py:170, in RequestMethods.request_encode_body(self, method, url, fields, headers, encode_multipart, multipart_boundary, **urlopen_kw)
168 extra_kw.update(urlopen_kw)
→ 170 return self.urlopen(method, url, **extra_kw)

File /opt/homebrew/lib/python3.11/site-packages/urllib3/poolmanager.py:376, in PoolManager.urlopen(self, method, url, redirect, **kw)
375 else:
→ 376 response = conn.urlopen(method, u.request_uri, **kw)
378 redirect_location = redirect and response.get_redirect_location()

File /opt/homebrew/lib/python3.11/site-packages/urllib3/connectionpool.py:787, in HTTPConnectionPool.urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
785 e = ProtocolError(“Connection aborted.”, e)
→ 787 retries = retries.increment(
788 method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
789 )
790 retries.sleep()

File /opt/homebrew/lib/python3.11/site-packages/urllib3/util/retry.py:550, in Retry.increment(self, method, url, response, error, _pool, _stacktrace)
549 if read is False or not self._is_method_retryable(method):
→ 550 raise six.reraise(type(error), error, _stacktrace)
551 elif read is not None:

File /opt/homebrew/lib/python3.11/site-packages/urllib3/packages/six.py:769, in reraise(tp, value, tb)
768 if value.traceback is not tb:
→ 769 raise value.with_traceback(tb)
770 raise value

File /opt/homebrew/lib/python3.11/site-packages/urllib3/connectionpool.py:703, in HTTPConnectionPool.urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
702 # Make the request on the httplib connection object.
→ 703 httplib_response = self._make_request(
704 conn,
705 method,
706 url,
707 timeout=timeout_obj,
708 body=body,
709 headers=headers,
710 chunked=chunked,
711 )
713 # If we’re going to release the connection in finally:, then
714 # the response doesn’t need to know about the connection. Otherwise
715 # it will also try to release it and we’ll have a double-release
716 # mess.

File /opt/homebrew/lib/python3.11/site-packages/urllib3/connectionpool.py:386, in HTTPConnectionPool._make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
385 try:
→ 386 self._validate_conn(conn)
387 except (SocketTimeout, BaseSSLError) as e:
388 # Py2 raises this as a BaseSSLError, Py3 raises it as socket timeout.

File /opt/homebrew/lib/python3.11/site-packages/urllib3/connectionpool.py:1042, in HTTPSConnectionPool._validate_conn(self, conn)
1041 if not getattr(conn, “sock”, None): # AppEngine might not have .sock
→ 1042 conn.connect()
1044 if not conn.is_verified:

File /opt/homebrew/lib/python3.11/site-packages/urllib3/connection.py:419, in HTTPSConnection.connect(self)
417 context.load_default_certs()
→ 419 self.sock = ssl_wrap_socket(
420 sock=conn,
421 keyfile=self.key_file,
422 certfile=self.cert_file,
423 key_password=self.key_password,
424 ca_certs=self.ca_certs,
425 ca_cert_dir=self.ca_cert_dir,
426 ca_cert_data=self.ca_cert_data,
427 server_hostname=server_hostname,
428 ssl_context=context,
429 tls_in_tls=tls_in_tls,
430 )
432 # If we’re using all defaults and the connection
433 # is TLSv1 or TLSv1.1 we throw a DeprecationWarning
434 # for the host.

File /opt/homebrew/lib/python3.11/site-packages/urllib3/util/ssl_.py:449, in ssl_wrap_socket(sock, keyfile, certfile, cert_reqs, ca_certs, server_hostname, ssl_version, ciphers, ssl_context, ca_cert_dir, key_password, ca_cert_data, tls_in_tls)
448 if send_sni:
→ 449 ssl_sock = _ssl_wrap_socket_impl(
450 sock, context, tls_in_tls, server_hostname=server_hostname
451 )
452 else:

File /opt/homebrew/lib/python3.11/site-packages/urllib3/util/ssl_.py:493, in _ssl_wrap_socket_impl(sock, ssl_context, tls_in_tls, server_hostname)
492 if server_hostname:
→ 493 return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
494 else:

File /opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ssl.py:517, in SSLContext.wrap_socket(self, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, session)
511 def wrap_socket(self, sock, server_side=False,
512 do_handshake_on_connect=True,
513 suppress_ragged_eofs=True,
514 server_hostname=None, session=None):
515 # SSLSocket class handles server_hostname encoding before it calls
516 # ctx._wrap_socket()
→ 517 return self.sslsocket_class._create(
518 sock=sock,
519 server_side=server_side,
520 do_handshake_on_connect=do_handshake_on_connect,
521 suppress_ragged_eofs=suppress_ragged_eofs,
522 server_hostname=server_hostname,
523 context=self,
524 session=session
525 )

File /opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ssl.py:1075, in SSLSocket._create(cls, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, context, session)
1074 raise ValueError(“do_handshake_on_connect should not be specified for non-blocking sockets”)
→ 1075 self.do_handshake()
1076 except (OSError, ValueError):

File /opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ssl.py:1346, in SSLSocket.do_handshake(self, block)
1345 self.settimeout(None)
→ 1346 self._sslobj.do_handshake()
1347 finally:

ProtocolError: (‘Connection aborted.’, ConnectionResetError(54, ‘Connection reset by peer’))

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

PineconeProtocolError Traceback (most recent call last)
Cell In[54], line 2
1 query = “…question deleted”
----> 2 docs = docsearch.similarity_search(query)

File /opt/homebrew/lib/python3.11/site-packages/langchain/vectorstores/pinecone.py:148, in Pinecone.similarity_search(self, query, k, filter, namespace, **kwargs)
146 query_obj = self._embedding_function(query)
147 docs =
→ 148 results = self._index.query(
149 [query_obj],
150 top_k=k,
151 include_metadata=True,
152 namespace=namespace,
153 filter=filter,
154 )
155 for res in results[“matches”]:
156 metadata = res[“metadata”]

File /opt/homebrew/lib/python3.11/site-packages/pinecone/core/utils/error_handling.py:25, in validate_and_convert_errors..inner_func(*args, **kwargs)
23 raise
24 except ProtocolError as e:
—> 25 raise PineconeProtocolError(f’Failed to connect; did you specify the correct index name?') from e

Hi @terrence,

Apologies for the late response here. From the stack trace, there are a number of potential causes for the error you’re having and it’s difficult to identify the exact cause.

I was able to surmise that you were using our python client from the trace? Since your post we’ve released updates to the client and I wonder if your issues would be resolved on a later version.

Due to the timeframe I’m going to go ahead and close this one out, but please feel free to repost if you are still facing issues. Thanks