"Namespace not found" from index.delete() call

I tried:

pc = Pinecone()
index = pc.Index(index_name)
index.delete(delete_all=True)

and I got:

Error clearing vectors: (404)
Reason: Not Found
HTTP response headers: HTTPHeaderDict({'Date': 'Mon, 15 Jul 2024 19:12:51 GMT', 'Content-Type': 'application/json', 'Content-Length': '55', 'Connection': 'keep-alive', 'x-pinecone-request-latency-ms': '91', 'x-pinecone-request-id': '3025412746948528664', 'x-envoy-upstream-service-time': '92', 'server': 'envoy'})
HTTP response body: {"code":5,"message":"Namespace not found","details":[]}

I also tried:

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

I’m not using namespaces. Please advise.

@mowliv, please share the output of index.describe_index_stats() or a screenshot of the Namespaces tab in the console for the index in question.

I tried “( Default )” as namespace, still fails.

2024-07-15 17:12:45,325 - WARNING - The index or namespace you're trying to clear doesn't exist. Skipping clear operation.
2024-07-15 17:12:45,327 - ERROR - Error clearing vectors: (404)
Reason: Not Found
HTTP response headers: HTTPHeaderDict({'Date': 'Tue, 16 Jul 2024 00:12:45 GMT', 'Content-Type': 'application/json', 'Content-Length': '55', 'Connection': 'keep-alive', 'x-pinecone-request-latency-ms': '93', 'x-pinecone-request-id': '8048362777244470397', 'x-envoy-upstream-service-time': '94', 'server': 'envoy'})
HTTP response body: {"code":5,"message":"Namespace not found","details":[]}

I also tried “Default” and “(Default)”…

( Default ) is not the name of a namespace; it is a placeholder in the console if a namespace is not specified upon upsert.

To delete all records from a namespace, provide a namespace parameter and specify the appropriate deleteAll parameter for your client. To target the default namespace, set namespace to "" . (Delete all records from a namespace)

index.delete(delete_all=True) or index.delete(delete_all=True, namespace=None) should work for deleting the default namespace as long as it contains records. If you are still experiencing unexpected behavior, please share the version of the Python SDK that you are using.

Hi both

I have the same problem sometimes when using an index created using the ‘starter’ index template. The error is the 404 Namespace not found.

(I have not managed to reproduce the issue using a ‘normal’ serverless index).

The issue occurs with both index.delete(delete_all=True) and index.delete(delete_all=True, namespace=None).

Going into the pinecone ui, and trying to manually delete the default index also fails after click saying Failed to delete namespace : Namespace not found:

The workaround I have found here is to delete the index itself and recreate it.

From my testing, this happens sometimes, but once it has occurred once, the namespace remains in this broken state until the index is recreated.


I am using the python pinecone-client==4.1.0.

When in the broken state, index.describe_index_stats() gives the following output:

{
    'dimension': 1536,
    'index_fullness': 0.01046,
    'namespaces': {'': {'vector_count': 1046}},
    'total_vector_count': 1046
}

The code used to connect/clear is:

pinecone_client = Pinecone(api_key="toto")
idx = pinecone_client.Index("toto")  
  
index_stats = idx.describe_index_stats()   
idx.delete(delete_all=True)

Please let me know if you have any recommendations to avoid this! Thanks