High severity beginner · Fix: 2-5 min

IndexNotFoundException

pinecone.exceptions.IndexNotFoundException

What this error means
This error occurs when attempting to upsert vectors into a Pinecone index that does not exist or is not initialized.

Stack trace

traceback
pinecone.exceptions.IndexNotFoundException: Index 'my-index' not found. Please create the index before upserting vectors.
QUICK FIX
Create the Pinecone index with the correct name before calling upsert to avoid the IndexNotFoundException.

Why it happens

Pinecone requires that the index be created and fully initialized before any upsert operations. If the index name is misspelled, deleted, or not created, the client raises this exception when trying to upsert vectors.

Detection

Check for IndexNotFoundException in your upsert calls and verify the index existence via Pinecone dashboard or API before upserting.

Causes & fixes

1

The Pinecone index was never created or was deleted.

✓ Fix

Create the index using Pinecone's create_index method before performing any upsert operations.

2

The index name used in the client does not match any existing index (typo or wrong environment).

✓ Fix

Verify and correct the index name string in your code to exactly match the existing Pinecone index.

3

The Pinecone client is connected to the wrong environment or project where the index does not exist.

✓ Fix

Ensure your Pinecone client is configured with the correct environment and project parameters matching where the index is created.

Code: broken vs fixed

Broken - triggers the error
python
import os
from pinecone import Pinecone

client = Pinecone(api_key=os.environ['PINECONE_API_KEY'], environment='us-west1-gcp')
index = client.Index('my-index')

# This line raises IndexNotFoundException if 'my-index' does not exist
index.upsert(vectors=[('id1', [0.1, 0.2, 0.3])])
Fixed - works correctly
python
import os
from pinecone import Pinecone

client = Pinecone(api_key=os.environ['PINECONE_API_KEY'])

# Create the index if it does not exist
if 'my-index' not in client.list_indexes():
    client.create_index(name='my-index', dimension=3)

index = client.Index('my-index')
index.upsert(vectors=[('id1', [0.1, 0.2, 0.3])])
print('Upsert succeeded')
Added index existence check and creation before upsert to ensure the index is available, preventing the IndexNotFoundException.

Workaround

Catch IndexNotFoundException around the upsert call, then create the index programmatically before retrying the upsert operation.

Prevention

Always verify index existence at application startup or deployment, and automate index creation in your infrastructure setup to avoid missing indexes during runtime.

Python 3.9+ · pinecone >=3.0.0 · tested on 3.2.x
Verified 2026-04
Verify ↗

Community Notes

No notes yetBe the first to share a version-specific fix or tip.