High severity beginner · Fix: 2-5 min

PineconeException

pinecone.exceptions.PineconeException

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

Stack trace

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

Why it happens

The Pinecone client throws this error when you try to upsert vectors into an index name that hasn't been created or is deleted. It can also happen if the index name is misspelled or if your API key lacks permissions to access the index.

Detection

Check for PineconeException with message containing 'Index not found' immediately after upsert calls. Logging the index name and Pinecone client status helps catch this early.

Causes & fixes

1

The Pinecone index was never created before upsert.

✓ Fix

Create the index using client.create_index() with the correct name and dimension before performing upsert operations.

2

The index name used in the upsert call is misspelled or incorrect.

✓ Fix

Verify and correct the index name string passed to Pinecone client methods to exactly match the created index.

3

The Pinecone API key or environment is misconfigured, causing inability to access the index.

✓ Fix

Ensure your API key and environment variables are correctly set in os.environ and that the key has permissions for the target index.

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=os.environ['PINECONE_ENV'])

# This will raise PineconeException if index does not exist
client.upsert(index_name='my-index', vectors=[('id1', [0.1, 0.2, 0.3])])  # Error here
Fixed - works correctly
python
import os
from pinecone import Pinecone

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

# Create index if it doesn't 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])])  # Fixed: index ensured
print('Upsert succeeded')
Added index existence check and creation before upsert to ensure the index exists, preventing the PineconeException. Updated to use Pinecone SDK v3+ syntax with client.Index and index.upsert.

Workaround

Catch PineconeException on upsert, then create the index dynamically before retrying the upsert operation.

Prevention

Implement index existence checks and automated creation in your initialization code to guarantee the index is always available before upsert calls.

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.