FlowiseAI/Flowise · error · Error
Chroma getOrCreateCollection error: ${err}
Error message
Chroma getOrCreateCollection error: ${err} What it means
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.
Source
Thrown at packages/components/nodes/vectorstores/Chroma/core.ts:117
* collection does not exist, it is created.
* @returns A promise that resolves with the `Collection` instance.
*/
async ensureCollection(): Promise<Collection> {
if (!this.collection) {
if (!this.index) {
this.index = new (await Chroma.imports()).ChromaClient({
path: this.url,
...(this.clientParams ?? {})
})
}
try {
this.collection = await this.index.getOrCreateCollection({
name: this.collectionName,
embeddingFunction: null,
...(this.collectionMetadata && { metadata: this.collectionMetadata })
})
} catch (err) {
throw new Error(`Chroma getOrCreateCollection error: ${err}`)
}
}
return this.collection
}
/**
* Adds vectors to the Chroma database. The vectors are associated with
* the provided documents.
* @param vectors An array of vectors to be added to the database.
* @param documents An array of `Document` instances associated with the vectors.
* @param options Optional. An object containing an array of `ids` for the vectors.
* @returns A promise that resolves with an array of document IDs when the vectors have been added to the database.
*/
async addVectors(vectors: number[][], documents: Document[], options?: { ids?: string[] }) {
if (vectors.length === 0) {
return []
}View on GitHub (pinned to abe4a8601a)
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.
Example fix
// before
} catch (err) {
throw new Error(`Chroma getOrCreateCollection error: ${err}`)
}
// after
} catch (err) {
throw new Error(`Chroma getOrCreateCollection error (url=${this.url}, collection=${this.collectionName}): ${err instanceof Error ? err.message : err}`, { cause: err })
} Defensive patterns
Strategy: try-catch
Validate before calling
await fetch(`${url}/api/v1/heartbeat`).then(r => { if (!r.ok) throw new Error('Chroma server not reachable') })
// avoid recreating a collection with different metadata
const existing = await client.getOrCreateCollection({ name: collectionName, embeddingFunction: null }).catch(() => null)
if (existing && collectionMetadata && JSON.stringify(existing.metadata) !== JSON.stringify(collectionMetadata)) {
throw new Error('metadata mismatch — recreate collection under a new name')
} Type guard
function isChromaClientConfig(v: unknown): v is { path: string; [k: string]: unknown } {
return typeof v === 'object' && v !== null && typeof (v as any).path === 'string'
} Try / catch
try {
await store.ensureCollection()
} catch (e) {
if (/getOrCreateCollection/i.test(String(e))) {
// surface server version / metadata hint
throw new Error(`Collection init failed; verify chromadb client/server versions and metadata: ${e}`)
}
throw e
} Prevention
- 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.
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- ${e}
- ${errorMessage}
- Error submitting tool outputs. Thread ID: ${threadId}. Run I
- HTTP error! status: ${response.status}
- Failed to fetch ${url}: ${error}
AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12).
Data as JSON: /api/errors/63cc2b5a615f3b17.
Report an issue: GitHub.