Getting gRPC unknown error when trying to delete all vectors using namespace

I’m running this code:

index.delete(namespace=NAMESPACE, delete_all=True)

and am getting this error:

*** pinecone.core.client.exceptions.PineconeException: UNKNOWN:Error received from peer  {grpc_message:"No explicit ids expected when delete_all=true", grpc_status:3, created_time:"202"}

I’m not providing any vector IDs though, just the namespace as is specified in the docs.

Hi @steven and welcome to the Pinecone community forums!

Thank you for your question.

Could you please share all your relevant code, being careful not to include secrets like your Pinecone API key, including where you installed the Pinecone library?

Which version are you currently running?

Best,
Zack

The code flow that I’m currently using first uses random vectors to query the index and retrieve all vectors for each namespace in the index (I can’t use index.list because it’s not serverless). I’m essentially using a dictionary that looks like {namespace: {vectors}}.

The code for deletion looks like this:

for namespace in namespace2vectors:
    index.delete(namespace=namespace, delete_all=True)

Note, when I change to code to provide the actual vector IDs the deletion happens properly:

for namespace, vectors in namespace2vectors.items():
    ids = list(vectors)
    index.delete(ids=ids, namespace=namespace)

I’m currently using a Poetry environment to manage my packages. The relevant packages are as follows:

[tool.poetry.dependencies]
python = "^3.10"
numpy = "^1.26.2"
tqdm = "^4.66.1"
requests = "^2.31.0"
google = "^3.0.0"
openai = "^1.3.5"
tiktoken = "^0.5.2"
tritonclient = {extras = ["grpc"], version = "^2.46.0"}
prometheus-fastapi-instrumentator = "^7.0.0"
prometheus-client = "^0.20.0"
grpcio = "^1.64.1"
pinecone-client = {extras = ["grpc"], version = "^4.1.1"}
python-dotenv = "^1.0.1"
google-api-python-client = "^2.133.0"

[tool.poetry.group.dev]
optional = true

[tool.poetry.group.dev.dependencies]
grpcio = "^1.60.1"
pymongo = "^4.6.1"

@steven Thanks for sharing the code. Please log the value of namespace inside the for loop in the code in question and share the result. For example:

for namespace in namespace2vectors:
    print(namespace)
    index.delete(namespace=namespace, delete_all=True)
1 Like

namespace is a string that refers to each namespace inside of the index.

@steven, yes, that’s understood. To debug the issue, I hope to see the values of namespace that get extracted from namespace2vectors, or just the complete namespace2vectors object.

If you do not feel comfortable sharing the namespace2vectors with the actual names, you can omit the details. I am curious to see the structure of the stored object. We likely need to improve our error messaging in some fashion, but I first want to determine the root cause of the behavior.