{"record":{"id":"02dc43ed033fa466","repo":"FlowiseAI/Flowise","slug":"e-02dc43","errorCode":null,"errorMessage":"${e}","messagePattern":"\\$\\{e\\}","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/vectorstores/Astra/Astra.ts","lineNumber":140,"sourceCode":"                        dimension: vectorDimension ?? 1536,\n                        metric: similarityMetric ?? 'cosine'\n                    }\n                }\n            }\n\n            const flattenDocs = docs && docs.length ? flatten(docs) : []\n            const finalDocs = []\n            for (let i = 0; i < flattenDocs.length; i += 1) {\n                if (flattenDocs[i] && flattenDocs[i].pageContent) {\n                    finalDocs.push(new Document(flattenDocs[i]))\n                }\n            }\n\n            try {\n                await AstraDBVectorStore.fromDocuments(finalDocs, embeddings, astraConfig)\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 embeddings = nodeData.inputs?.embeddings as Embeddings\n        const vectorDimension = nodeData.inputs?.vectorDimension as number\n        const similarityMetric = nodeData.inputs?.similarityMetric as 'cosine' | 'euclidean' | 'dot_product' | undefined\n        const astraCollection = nodeData.inputs?.astraCollection as string\n        const credentialData = await getCredentialData(nodeData.credential ?? '', options)\n\n        const expectedSimilarityMetric = ['cosine', 'euclidean', 'dot_product']\n        if (similarityMetric && !expectedSimilarityMetric.includes(similarityMetric)) {\n            throw new Error(`Invalid Similarity Metric should be one of 'cosine' | 'euclidean' | 'dot_product'`)\n        }\n\n        const clientConfig = {\n            token: credentialData?.applicationToken,","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/vectorstores/Astra/Astra.ts#L122-L158","documentation":"Thrown in Astra vectorStoreMethods.upsert as the catch-all around AstraDBVectorStore.fromDocuments. Covers DB connection, auth, collection, and document-insertion failures. Uses `throw new Error(e)` which coerces the underlying error to a string, losing the stack and type.","triggerScenarios":"Invalid/expired application token; wrong dbEndPoint; collection does not exist or has mismatched vector dimension; embeddings dimension differs from the collection's configured vector dimension; network failure to Astra; rate limit from DataStax.","commonSituations":"Astra credentials not bound or expired; endpoint URL wrong; vectorDimension input does not match the embedding model output; collection created with a different dimension; transient Astra outage.","solutions":["Verify the Astra credential (applicationToken, dbEndPoint) in Flowise credential manager.","Confirm vectorDimension matches the embeddings model (e.g. 1536 for text-embedding-ada-002).","Ensure the collection exists and was created with the same vector dimension.","Retry on transient failures; check DataStax status page for outages."],"exampleFix":"// before\nsimilarityMetric = 'cosine'\nvectorDimension = 768   // but embeddings produce 1536 -> Astra rejects\n\n// after\nvectorDimension = 1536  // match the embeddings model","handlingStrategy":"try-catch","validationCode":"async function preflightAstra(creds: any, vectorDimension: number, embeddings: any) {\n  if (!creds?.applicationToken) throw new Error('Astra applicationToken missing in credentials')\n  if (!creds?.dbEndPoint || !/^https?:\\/\\//.test(creds.dbEndPoint)) throw new Error('Astra dbEndPoint missing/invalid')\n  // probe embedding dimension with a tiny input if the model exposes it\n  if (typeof embeddings?.embedQuery === 'function') {\n    const v = await embeddings.embedQuery('dimension probe')\n    if (v.length !== vectorDimension) throw new Error(`Embedding dimension ${v.length} != configured vectorDimension ${vectorDimension}`)\n  }\n}","typeGuard":"const hasAstraCreds = (c: any): c is { applicationToken: string; dbEndPoint: string } =>\n  typeof c?.applicationToken === 'string' && typeof c?.dbEndPoint === 'string' && /^https?:\\/\\//.test(c.dbEndPoint)","tryCatchPattern":"try { return await astraNode.vectorStoreMethods.upsert(nodeData, options) }\ncatch (e) {\n  const msg = (e as Error).message\n  if (/unauthor|401|token/i.test(msg)) throw new Error('Astra auth failed — check applicationToken')\n  if (/dimension|expected.*vector/i.test(msg)) throw new Error('vectorDimension mismatch — align with embeddings model')\n  if (/not found|collection/i.test(msg)) throw new Error('Astra collection missing or misconfigured')\n  throw e\n}","preventionTips":["Verify applicationToken and dbEndPoint in Flowise credential manager.","Keep vectorDimension in lockstep with the embeddings model output.","Create the collection with the same dimension before first upsert.","Retry transient network/5xx errors with backoff."],"tags":["vector-store","astra","network","credentials","error-wrapping"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}