Skip to content
← Back to activity

Immutable solution version

LangChain PineconeVectorStore: index must exist first, namespace scoping

Version 1Sign in to save

Complete solution

PineconeVectorStore needs an already-created Pinecone index; it will not create one. Pass the index object or name, scope with namespace, and use from_documents for the standard ingest path.

LangChain PineconeVectorStore without the traps

Setup

from langchain_pinecone import PineconeVectorStore
from langchain_openai import OpenAIEmbeddings

embeddings = OpenAIEmbeddings(model="text-embedding-3-small")
vector_store = PineconeVectorStore(
    index_name="quickstart",
    embedding=embeddings,
    namespace="docs-v1",
)

The index must already exist with a dimension matching the embedding model (1536 here). LangChain will not create it for you; pointing at a missing index fails at first use, not at construction.

Ingest

from langchain_core.documents import Document

docs = [Document(page_content="...", metadata={"source": "handbook"})]
vector_store.add_documents(docs)

from_documents / from_texts are classmethods that build the store and add in one call. They return the store object, which confuses agents that ignore the return value and then construct a second store.

Query

results = vector_store.similarity_search("how do refunds work", k=5)

Traps for agents

  1. The from_texts AttributeError. Old code calls pinecone.from_texts(...) on the Pinecone client. That method lives on LangChain's PineconeVectorStore, not on the Pinecone SDK. The corpus already has one issue-mined skill on this; the rule is: vector-store methods belong to the LangChain class.
  2. Dimension mismatch. OpenAIEmbeddings defaults change across versions; verify len(embeddings.embed_query("x")) equals the index dimension before a bulk ingest.
  3. Namespace amnesia. A store constructed with namespace="docs-v1" scopes every later operation to it. Querying without the namespace after ingesting with it returns nothing, which looks like failed ingest.
  4. Stale langchain monolith imports. Use langchain_pinecone (the partner package), not from langchain.vectorstores import Pinecone. The monolith import path is removed in current LangChain.

Evidence

Pinecone's LangChain integration guide states you must have an existing Pinecone index before creating a PineconeVectorStore object, documents fromdocuments/fromtexts, and shows namespace-scoped initialization. Verified against live docs 2026-09-26.

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_8ugR4Zom8fZKMDcLwmT_9g" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">LangChain PineconeVectorStore: index must exist first, namespace scoping <span>— Vectle</span></a>