FlowiseAI/Flowise · critical · Error

Please install chromadb as a dependency with, e.g. `npm inst

Error message

Please install chromadb as a dependency with, e.g. `npm install -S chromadb`

What it means

Chroma.imports() dynamically imports 'chromadb'; if the module cannot be resolved the install hint is thrown. This is a dependency-resolution error, not a runtime logic error.

Source

Thrown at packages/components/nodes/vectorstores/Chroma/core.ts:333

     * @param embeddings An `Embeddings` instance used to generate embeddings for the documents.
     * @param dbConfig A `ChromaLibArgs` object containing the configuration for the Chroma database.
     * @returns A promise that resolves with a new `Chroma` instance.
     */
    static async fromExistingCollection(embeddings: EmbeddingsInterface, dbConfig: ChromaLibArgs): Promise<Chroma> {
        const instance = new this(embeddings, dbConfig)
        await instance.ensureCollection()
        return instance
    }

    /** @ignore */
    static async imports(): Promise<{
        ChromaClient: typeof ChromaClientT
    }> {
        try {
            const { ChromaClient } = await import('chromadb')
            return { ChromaClient }
        } catch {
            throw new Error('Please install chromadb as a dependency with, e.g. `npm install -S chromadb`')
        }
    }
}

/**
 * Generates a unique collection name if none is provided.
 */
function ensureCollectionName(collectionName?: string) {
    if (!collectionName) {
        return `langchain-${uuid.v4()}`
    }
    return collectionName
}

/**
 * Sanitizes metadata to only include Chroma-compatible primitive values.
 * Chroma metadata only supports boolean, number, string, and null values.
 * Arrays and objects are JSON stringified to preserve the data.

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Run `npm install chromadb` (or `pnpm add chromadb` / `yarn add chromadb`) in the workspace that resolves this module.
  2. In a monorepo, ensure the package is installed in the consuming workspace or hoisted correctly.
  3. If bundling, ensure chromadb is not erroneously externalized or vice-versa for the target runtime.

Example fix

// before: chromadb not installed -> throw on dynamic import

// after (terminal)
npm install chromadb
Defensive patterns

Strategy: validation

Validate before calling

// preflight at startup
async function ensureChroma() {
  try {
    await import('chromadb')
  } catch {
    throw new Error('chromadb not installed. Run: npm install chromadb')
  }
}
await ensureChroma()

Type guard

async function isChromadbInstalled(): Promise<boolean> {
  try { await import('chromadb'); return true } catch { return false }
}

Try / catch

try {
  await Chroma.imports()
} catch (e) {
  if (/install chromadb/i.test(String(e))) {
    throw new Error('Missing optional dependency. Run `npm install chromadb` then restart.', { cause: e })
  }
  throw e
}

Prevention

When it happens

Trigger: First call to fromDocuments / ensureCollection / any path that triggers Chroma.imports(). Fails when chromadb is absent from node_modules, the bundle excluded it, or a monorepo hoisting issue prevents resolution.

Common situations: Missing `npm install chromadb`, monorepo with hoisting where the package lives only in a sibling workspace, bundler tree-shaking or marking it external incorrectly, or a Node version incompatible with the package's ESM/CJS layout.

Related errors


AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12). Data as JSON: /api/errors/1d93f25a46b375a5. Report an issue: GitHub.