{"record":{"id":"75a5d7a471d04a1c","repo":"n8n-io/n8n","slug":"error-connecting-to-chromadb-message","errorCode":null,"errorMessage":"Error connecting to ChromaDB: ${message}","messagePattern":"Error connecting to ChromaDB: (.+?)","errorType":"exception","errorClass":"NodeOperationError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/nodes-langchain/nodes/vector_store/VectorStoreChromaDB/VectorStoreChromaDB.node.ts","lineNumber":405,"sourceCode":"\tloadFields: retrieveFields,\n\tinsertFields,\n\tsharedFields,\n\n\tasync getVectorStoreClient(context, _filter, embeddings, itemIndex) {\n\t\tconst collection = context.getNodeParameter('chromaCollection', itemIndex, '', {\n\t\t\textractValue: true,\n\t\t});\n\n\t\tif (typeof collection !== 'string') {\n\t\t\tthrow new NodeOperationError(context.getNode(), 'Collection must be a string');\n\t\t}\n\n\t\ttry {\n\t\t\tconst config = await getChromaLibConfig(context, collection, itemIndex);\n\t\t\treturn await ExtendedChroma.fromExistingCollection(embeddings, config);\n\t\t} catch (error) {\n\t\t\tconst message = error instanceof Error ? error.message : 'Unknown error';\n\t\t\tthrow new NodeOperationError(context.getNode(), `Error connecting to ChromaDB: ${message}`, {\n\t\t\t\titemIndex,\n\t\t\t});\n\t\t}\n\t},\n\n\tasync populateVectorStore(context, embeddings, documents, itemIndex) {\n\t\tconst collection = context.getNodeParameter('chromaCollection', itemIndex, '', {\n\t\t\textractValue: true,\n\t\t});\n\n\t\tif (typeof collection !== 'string') {\n\t\t\tthrow new NodeOperationError(context.getNode(), 'Collection must be a string');\n\t\t}\n\n\t\tconst options = context.getNodeParameter('options', itemIndex, {});\n\t\tconst clearCollection = options.clearCollection === true;\n\n\t\tif (clearCollection) {","sourceCodeStart":387,"sourceCodeEnd":423,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/nodes-langchain/nodes/vector_store/VectorStoreChromaDB/VectorStoreChromaDB.node.ts#L387-L423","documentation":"Catch-all NodeOperationError in `getVectorStoreClient` for any failure from `getChromaLibConfig` or `ExtendedChroma.fromExistingCollection`. The original error message is appended. This wraps the LangChain-side Chroma construction that binds the embeddings function, the URL, and the existing collection name into a VectorStore instance.","triggerScenarios":"The named collection does not exist on the server (so fromExistingCollection cannot bind); the collection exists but has incompatible metadata; the URL/auth config cannot be assembled from the credential; the underlying ChromaClient throws during the first lazy call.","commonSituations":"User typed a collection name that does not exist yet; collection was deleted between workflow save and run; switching from one credential to another pointing at a different ChromaDB instance; SDK version change altering the fromExistingCollection signature.","solutions":["Read the appended `message` — it usually says whether the collection is missing or the connection failed.","If the collection is missing, create it first (insert mode) or pick an existing one from the dropdown.","Verify the credential's URL and API key still match the running ChromaDB.","Retry after confirming ChromaDB is reachable from the n8n host."],"exampleFix":"// before\ntry {\n  const config = await getChromaLibConfig(context, collection, itemIndex);\n  return await ExtendedChroma.fromExistingCollection(embeddings, config);\n} catch (error) {\n  const message = error instanceof Error ? error.message : 'Unknown error';\n  throw new NodeOperationError(context.getNode(), `Error connecting to ChromaDB: ${message}`, { itemIndex });\n}\n\n// after: classify the common 'collection not found' case so the user gets a fix\n} catch (error) {\n  const message = error instanceof Error ? error.message : 'Unknown error';\n  const notFound = /does not exist|not found/i.test(message);\n  throw new NodeOperationError(\n    context.getNode(),\n    `Error connecting to ChromaDB: ${message}`,\n    {\n      itemIndex,\n      description: notFound\n        ? `Collection \"${collection}\" does not exist. Run the node in Insert mode to create it.`\n        : 'Verify the ChromaDB URL and credentials.',\n    },\n  );\n}","handlingStrategy":"validation","validationCode":"// Confirm the collection exists before binding it to ExtendedChroma.\nasync function ensureCollectionExists(client: ChromaClient, name: string): Promise<void> {\n  const names = (await client.listCollections()).map((c) => (typeof c === 'string' ? c : c.name));\n  if (!names.includes(name)) {\n    throw new Error(`Collection \"${name}\" does not exist; run the node in Insert mode first.`);\n  }\n}","typeGuard":"function isMissingCollectionError(error: unknown): boolean {\n  return error instanceof Error && /does not exist|not found/i.test(error.message);\n}","tryCatchPattern":"try {\n  const config = await getChromaLibConfig(context, collection, itemIndex);\n  return await ExtendedChroma.fromExistingCollection(embeddings, config);\n} catch (error) {\n  const message = error instanceof Error ? error.message : 'Unknown error';\n  throw new NodeOperationError(context.getNode(), `Error connecting to ChromaDB: ${message}`, {\n    itemIndex,\n    description: isMissingCollectionError(error)\n      ? `Collection \"${collection}\" does not exist. Run in Insert mode to create it.`\n      : 'Verify the ChromaDB URL and credentials.',\n  });\n}","preventionTips":["Use the dropdown to pick existing collections rather than typing names.","Run Insert mode once to create a collection before Load/Retrieve.","Verify the credential still points at the right ChromaDB instance."],"tags":["chromadb","vector-store","catch-all","node-operation-error","langchain"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}