{"record":{"id":"d8e23dec05583ed2","repo":"FlowiseAI/Flowise","slug":"e-d8e23d","errorCode":null,"errorMessage":"${e}","messagePattern":"\\$\\{e\\}","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/vectorstores/Pinecone/Pinecone_LlamaIndex.ts","lineNumber":156,"sourceCode":"            for (let i = 0; i < flattenDocs.length; i += 1) {\n                if (flattenDocs[i] && flattenDocs[i].pageContent) {\n                    finalDocs.push(new LCDocument(flattenDocs[i]))\n                }\n            }\n\n            const llamadocs: Document[] = []\n            for (const doc of finalDocs) {\n                llamadocs.push(new Document({ text: doc.pageContent, metadata: doc.metadata }))\n            }\n\n            const serviceContext = serviceContextFromDefaults({ llm: model, embedModel: embeddings })\n            const storageContext = await storageContextFromDefaults({ vectorStore: pcvs })\n\n            try {\n                await VectorStoreIndex.fromDocuments(llamadocs, { serviceContext, storageContext })\n                return { numAdded: finalDocs.length, addedDocs: finalDocs }\n            } catch (e) {\n                throw new Error(e)\n            }\n        }\n    }\n\n    async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {\n        const indexName = nodeData.inputs?.pineconeIndex as string\n        const pineconeNamespace = nodeData.inputs?.pineconeNamespace as string\n        const pineconeMetadataFilter = nodeData.inputs?.pineconeMetadataFilter\n        const embeddings = nodeData.inputs?.embeddings as BaseEmbedding\n        const model = nodeData.inputs?.model\n        const topK = nodeData.inputs?.topK as string\n        const k = topK ? parseFloat(topK) : 4\n\n        const credentialData = await getCredentialData(nodeData.credential ?? '', options)\n        const pineconeApiKey = getCredentialParam('pineconeApiKey', credentialData, nodeData)\n\n        const obj: PineconeParams = {\n            indexName,","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/vectorstores/Pinecone/Pinecone_LlamaIndex.ts#L138-L174","documentation":"Generic catch-all in the Pinecone (LlamaIndex) node wrapping `VectorStoreIndex.fromDocuments`. Any failure during LlamaIndex index construction (embedding, Pinecone write, service context error) is re-thrown as `new Error(e)`, losing the original stack.","triggerScenarios":"Pinecone client/auth failure; embedding model error; service context misconfiguration (missing llm/embedModel); dimension mismatch between embedModel and the Pinecone index; network failure to Pinecone.","commonSituations":"Mixing LlamaIndex and LangChain embedding types; Pinecone serverless region mismatch; API key expired; embedding model returns a dimension different from the index.","solutions":["Inspect the flattened message for the LlamaIndex/Pinecone underlying error.","Confirm `model` and `embeddings` are LlamaIndex-compatible `BaseEmbedding`/LLM instances.","Verify Pinecone API key, index, and that the index dimension matches `embedModel`.","Re-wrap preserving the original error (see fix)."],"exampleFix":"// before\n} catch (e) {\n    throw new Error(e)\n}\n// after — preserve cause\n} catch (e) {\n    throw e instanceof Error ? e : new Error(String(e))\n}","handlingStrategy":"try-catch","validationCode":"// preflight: ensure LlamaIndex-compatible embed model + matching dimension\nif (!embeddings || typeof (embeddings as any).getTextEmbedding !== 'function') {\n  throw new Error('embeddings must be a LlamaIndex BaseEmbedding')\n}\nconst dim = (await (embeddings as any).getTextEmbedding('test')).length\nif (indexDimension && dim !== indexDimension) throw new Error(`dim ${dim} != index ${indexDimension}`)","typeGuard":"function isLlamaIndexEmbedding(v: unknown): boolean {\n  return typeof v === 'object' && v !== null && typeof (v as any).getTextEmbedding === 'function'\n}","tryCatchPattern":"try {\n  await VectorStoreIndex.fromDocuments(llamadocs, { serviceContext, storageContext })\n} catch (e) {\n  throw e instanceof Error ? e : new Error(`LlamaIndex Pinecone index build failed: ${String(e)}`)\n}","preventionTips":["Use LlamaIndex BaseEmbedding (not LangChain Embeddings) with this node.","Confirm Pinecone index dimension matches the embed model.","Verify API key/region before index construction.","Re-wrap errors preserving the original."],"tags":["pinecone","llamaindex","error-handling","stack-trace"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}