{"record":{"id":"63cc2b5a615f3b17","repo":"FlowiseAI/Flowise","slug":"chroma-getorcreatecollection-error-err","errorCode":null,"errorMessage":"Chroma getOrCreateCollection error: ${err}","messagePattern":"Chroma getOrCreateCollection error: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/vectorstores/Chroma/core.ts","lineNumber":117,"sourceCode":"     * collection does not exist, it is created.\n     * @returns A promise that resolves with the `Collection` instance.\n     */\n    async ensureCollection(): Promise<Collection> {\n        if (!this.collection) {\n            if (!this.index) {\n                this.index = new (await Chroma.imports()).ChromaClient({\n                    path: this.url,\n                    ...(this.clientParams ?? {})\n                })\n            }\n            try {\n                this.collection = await this.index.getOrCreateCollection({\n                    name: this.collectionName,\n                    embeddingFunction: null,\n                    ...(this.collectionMetadata && { metadata: this.collectionMetadata })\n                })\n            } catch (err) {\n                throw new Error(`Chroma getOrCreateCollection error: ${err}`)\n            }\n        }\n\n        return this.collection\n    }\n\n    /**\n     * Adds vectors to the Chroma database. The vectors are associated with\n     * the provided documents.\n     * @param vectors An array of vectors to be added to the database.\n     * @param documents An array of `Document` instances associated with the vectors.\n     * @param options Optional. An object containing an array of `ids` for the vectors.\n     * @returns A promise that resolves with an array of document IDs when the vectors have been added to the database.\n     */\n    async addVectors(vectors: number[][], documents: Document[], options?: { ids?: string[] }) {\n        if (vectors.length === 0) {\n            return []\n        }","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/vectorstores/Chroma/core.ts#L99-L135","documentation":"Thrown by Chroma.ensureCollection() when ChromaClient.getOrCreateCollection rejects. The client was already constructed with the URL and clientParams, so this failure is specifically about collection creation/lookup on the server — server-side errors, auth, metadata schema violations, or transport failures during the RPC.","triggerScenarios":"First call to addVectors/delete/similaritySearch when no collection is cached. Triggers if the Chroma server returns an error for getOrCreateCollection (e.g. collection exists with incompatible metadata, server version mismatch, connection reset, embeddingFunction null rejected by newer server).","commonSituations":"Chroma server version incompatible with the chromadb client version, collection recreated with different metadata on the same name, server overloaded/disk full, or TLS/reverse-proxy stripping the response body.","solutions":["Check the Chroma server version matches the `chromadb` npm package version (breaking changes between 1.x and 0.x).","Delete and recreate the collection if metadata changed, or rename it.","Inspect server logs for the actual getOrCreateCollection failure.","Confirm the URL/path and any auth headers in clientParams are correct."],"exampleFix":"// before\n} catch (err) {\n    throw new Error(`Chroma getOrCreateCollection error: ${err}`)\n}\n\n// after\n} catch (err) {\n    throw new Error(`Chroma getOrCreateCollection error (url=${this.url}, collection=${this.collectionName}): ${err instanceof Error ? err.message : err}`, { cause: err })\n}","handlingStrategy":"try-catch","validationCode":"await fetch(`${url}/api/v1/heartbeat`).then(r => { if (!r.ok) throw new Error('Chroma server not reachable') })\n// avoid recreating a collection with different metadata\nconst existing = await client.getOrCreateCollection({ name: collectionName, embeddingFunction: null }).catch(() => null)\nif (existing && collectionMetadata && JSON.stringify(existing.metadata) !== JSON.stringify(collectionMetadata)) {\n  throw new Error('metadata mismatch — recreate collection under a new name')\n}","typeGuard":"function isChromaClientConfig(v: unknown): v is { path: string; [k: string]: unknown } {\n  return typeof v === 'object' && v !== null && typeof (v as any).path === 'string'\n}","tryCatchPattern":"try {\n  await store.ensureCollection()\n} catch (e) {\n  if (/getOrCreateCollection/i.test(String(e))) {\n    // surface server version / metadata hint\n    throw new Error(`Collection init failed; verify chromadb client/server versions and metadata: ${e}`)\n  }\n  throw e\n}","preventionTips":["Keep chromadb client and server on compatible major versions.","Never recreate a collection with new metadata on the same name.","Health-check the server before init."],"tags":["chroma","collection","initialization","network"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}