Index.upsert() + "Failed to connect; did you specify the correct index name?"


I get this error : Failed to connect; did you specify the correct index name? while doing index.upsert().

I am on Standard Plan.

my code:

import pinecone
index_name = os.getenv("INDEX_NAME")
pinecone.init(project_name=project_name, api_key=api_key, environment=environment)' Pinecone indexs####: {pinecone.list_indexes()}').  ## Logs index name correctly
index = pinecone.Index(index_name=index_name). # index_name is correctly here
pinecone_index_documents = [('id1',embedding, metadata),...] # This format is correct, wroked on free tier plan
index.upsert(pinecone_index_documents) # gets error  here :  Failed to connect; did you specify the correct index name?**

No Idea what’s going on. I ma running it in Azure python function app…

Any help is appreciated.

Hi @ankur.gupta

I see you are using the python client? Try to add the “namespace” property when upserting. Like:

index.upsert(pinecone_index_documents, 'namespace-1')

If the error persists, follow the exact code from here: Python Client (upserting) I think the code from the documentation should be good. I never used the project_name parameter when init-ing my indexes (documentation: Python Client (init) does not specify it as well) so try removing that from the code as well and see if it works.

And if that won’t work for you use the Standard support to open a ticket and the Pinecone support team will help you out.

Hope this helps

1 Like


I was able to solve it.

I am on standard plan and created a new project and not using default project.

So here we do need to set project_name:
pinecone.init(project_name=project_name, api_key=api_key, environment=environment)

Issue was I was setting project_name argument value as the project’s name, but it actually needs project’s id to build the endpoint correctly, i.e.: “9e5ac96” below. Looks like documentation need to clarify it somehwere.

1 Like

Ah I see. Yeah after upgrading, the existing project stays in Free tier and you have to create a new one to truly upgrade. Glad you got it working!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.