{"record":{"id":"42faa6700aaba1f8","repo":"n8n-io/n8n","slug":"chroma-getorcreatecollection-error-message","errorCode":null,"errorMessage":"Chroma getOrCreateCollection error: ${message}","messagePattern":"Chroma getOrCreateCollection error: (.+?)","errorType":"exception","errorClass":"OperationalError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/nodes-langchain/nodes/vector_store/VectorStoreChromaDB/VectorStoreChromaDB.node.ts","lineNumber":222,"sourceCode":"\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\t// Use ChromaClient for self-hosted instances\n\t\t\t\t\tconst { ChromaClient } = await ExtendedChroma.imports();\n\t\t\t\t\tconst clientConfig = this.url ? { path: this.url, ...clientParams } : clientParams;\n\n\t\t\t\t\tthis.index = new ChromaClient(clientConfig);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tthis.collection = await this.index.getOrCreateCollection({\n\t\t\t\t\tname: this.collectionName,\n\t\t\t\t\t...(this.collectionMetadata && { metadata: this.collectionMetadata }),\n\t\t\t\t\tembeddingFunction: null,\n\t\t\t\t});\n\t\t\t} catch (error) {\n\t\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\t\tthrow new OperationalError(`Chroma getOrCreateCollection error: ${message}`);\n\t\t\t}\n\t\t}\n\n\t\tif (!this.collection) {\n\t\t\tthrow new OperationalError('Failed to initialize Chroma collection');\n\t\t}\n\n\t\treturn this.collection;\n\t}\n\n\tasync similaritySearchVectorWithScore(\n\t\tquery: number[],\n\t\tk: number,\n\t\tfilter?: this['FilterType'],\n\t): Promise<Array<[Document, number]>> {\n\t\t// Handle the case where query might actually be a nested array which is usually the case.\n\n\t\tlet flatQuery: number[] = [];","sourceCodeStart":204,"sourceCodeEnd":240,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/nodes-langchain/nodes/vector_store/VectorStoreChromaDB/VectorStoreChromaDB.node.ts#L204-L240","documentation":"ExtendedChroma.ensureCollection wraps any failure of ChromaClient/CloudClient.getOrCreateCollection in an OperationalError. The underlying message is appended. This is the first touchpoint with the Chroma server (or Chroma Cloud), so most connection/config problems surface here.","triggerScenarios":"this.index.getOrCreateCollection({ name, metadata?, embeddingFunction: null }) rejects — Chroma server unreachable, Cloud API key invalid, collection name has illegal characters, collection metadata rejected, or the Chroma version rejects embeddingFunction:null.","commonSituations":"ChromaDB server URL wrong or server down (self-hosted); Chroma Cloud apiKey/tenant/database incorrect; ChromaDB version incompatibility (older versions do not accept embeddingFunction:null); collection name contains spaces/special characters; collection metadata with non-string values; CORS/network issue from the n8n host.","solutions":["Verify the ChromaDB server URL is reachable from the n8n host (curl the /api/v1/heartbeat endpoint).","For Chroma Cloud, confirm apiKey, tenant, and database are correct.","Upgrade (or downgrade) the ChromaDB server to a version compatible with the langchain Chroma integration used here.","Simplify the collection name to alphanumeric/hyphen/underscore and remove non-string metadata.","Inspect the appended message — it usually states the exact server-side refusal."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Health-check Chroma before getOrCreateCollection.\ntry {\n  await this.index.heartbeat(); // ChromaClient exposes heartbeat()\n} catch {\n  throw new Error('ChromaDB server is unreachable at the configured URL before collection init.');\n}","typeGuard":null,"tryCatchPattern":"try {\n  this.collection = await this.index.getOrCreateCollection({\n    name: this.collectionName,\n    ...(this.collectionMetadata && { metadata: this.collectionMetadata }),\n    embeddingFunction: null,\n  });\n} catch (error) {\n  const message = error instanceof Error ? error.message : String(error);\n  throw new OperationalError(`Chroma getOrCreateCollection error: ${message}`);\n}","preventionTips":["Run a heartbeat/health check against ChromaDB before initializing collections.","Pin a ChromaDB server version known to accept embeddingFunction:null.","Restrict collection names to [A-Za-z0-9_-] and stringify all metadata values."],"tags":["chromadb","vector-store","network","configuration","operational-error"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}