Repository navigation
Labels
bugSomething isn't working
Description
Is this a new bug?
- I believe this is a new bug
- I have searched the existing issues, and I could not find an existing issue for this bug
Current Behavior
In v10, fetch, list_paginated and list_namespaces(prefix=...) find nothing when an ID or namespace contains a space. No error is raised.
fetchleaves out records whose IDs contain a space, e.g."doc 42".- If the namespace name contains a space,
list_paginatedandfetchreturn nothing at all, andlist_namespaces(prefix=...)doesn't find it.
upsert and query work with the same IDs and namespaces, since they send them in a JSON body.
Expected Behavior
fetch, list_paginated and list_namespaces(prefix=...) find IDs and namespaces with spaces, as upsert and query do. Spaces should be sent as %20 in the query string, as they are in 8.1.2.
Steps To Reproduce
- Use any existing dense index and set
PINECONE_API_KEY. The script writes its own records to a new namespace and deletes the namespace at the end. - Run this script with pinecone 10.0.0 (replace
my-index). It prints each request list and fetch send:
import time
import uuid
import pinecone
from pinecone import Pinecone
def show(method, path):
if method == "GET" and path.startswith("/vectors/"):
print(f" {method} {path}")
try: # pinecone 9+ (httpx)
import httpx
_send = httpx.Client.send
def send(self, request, *args, **kwargs):
show(request.method, request.url.raw_path.decode())
return _send(self, request, *args, **kwargs)
httpx.Client.send = send
except ImportError: # pinecone 8 and earlier (urllib3)
import urllib3
_urlopen = urllib3.PoolManager.urlopen
def urlopen(self, method, url, *args, **kwargs):
show(method, url[url.index("/", url.index("//") + 2):])
return _urlopen(self, method, url, *args, **kwargs)
urllib3.PoolManager.urlopen = urlopen
index_name = "my-index"
pc = Pinecone() # PINECONE_API_KEY
dimension = pc.describe_index(index_name).dimension
index = pc.Index(index_name)
namespace = f"repro {uuid.uuid4().hex[:8]}" # note the space
ids = ["doc-42", "doc 42", "doc-42 ", "doc+42"]
index.upsert(
vectors=[{"id": rid, "values": [1.0] + [0.0] * (dimension - 1)} for rid in ids],
namespace=namespace,
)
time.sleep(30) # let the writes become visible
try:
print("list:")
print(f" -> {[v.id for v in index.list_paginated(namespace=namespace).vectors]}")
print("fetch:")
print(f" -> {sorted(index.fetch(ids=ids, namespace=namespace).vectors)}")
finally:
if int(pinecone.__version__.split(".")[0]) >= 9:
index.delete_namespace(name=namespace)
else:
index.delete_namespace(namespace=namespace)- Spaces are sent as
+, andlistandfetchreturn nothing. - Run the same script with pinecone 8.1.2. Spaces are sent as
%20, and every record is found.
Relevant log output
# pinecone 10.0.0: spaces are sent as "+", and nothing is found
list:
GET /vectors/list?namespace=repro+76f3b5f9
-> []
fetch:
GET /vectors/fetch?ids=doc-42&ids=doc+42&ids=doc-42+&ids=doc%2B42&namespace=repro+76f3b5f9
-> []
# pinecone 8.1.2: spaces are sent as "%20", and every record is found
list:
GET /vectors/list?namespace=repro%20cc1d34c7
-> ['doc 42', 'doc+42', 'doc-42', 'doc-42 ']
fetch:
GET /vectors/fetch?namespace=repro%20cc1d34c7&ids=doc-42&ids=doc%2042&ids=doc-42%20&ids=doc%2B42
-> ['doc 42', 'doc+42', 'doc-42', 'doc-42 ']Environment
- **OS**: Windows 11
- **Language version**: Python 3.13.2
- **Pinecone client version**: 10.0.0 (broken), 8.1.2 (works). 10.1.0 and `main` look affected too, from reading the code (not run).Additional Context
Cause. HTTPClient.get passes query parameters to httpx, which encodes a space as +. Pinecone reads + as a plus sign, so ?ids=doc+42 asks for doc+42. The async client does the same.
Regression of #372, which fixed this by sending spaces as %20. That fix lived in the urllib3 client, which 9.0.0 replaced with httpx.
Metadata
Metadata
Assignees
Labels
bugSomething isn't working
Activity
[-][Bug] <title>[/-][+][Bug] Spaces in IDs and namespaces sent as "+" in GET requests since 9.0.0 (regression of #372)[/+]