chroma-core/chroma · error · Error
Please install the voyageai package to use the VoyageAIEmbed
Error message
Please install the voyageai package to use the VoyageAIEmbeddingFunction, `npm install -S voyageai`
What it means
VoyageAIEmbeddingFunction.initClient() lazily does `await import('voyageai')` on the first generate(); if the rejection carries code MODULE_NOT_FOUND it rethrows as this friendly install hint, otherwise the original error propagates. Caveat: under Node ESM a missing package actually fails with ERR_MODULE_NOT_FOUND (a TypeError without .code === 'MODULE_NOT_FOUND'), so you may see the raw import error instead — same root cause, missing optional dependency.
Source
Thrown at clients/js/packages/chromadb-core/src/embeddings/VoyageAIEmbeddingFunction.ts:81
);
}
this.apiKey = apiKey;
this.model = model;
this.apiKeyEnvVar = api_key_env_var;
}
private async initClient() {
if (this.voyageAiApi) return;
try {
// @ts-ignore
this.voyageAiApi = await import("voyageai").then((voyageai) => {
// @ts-ignore
return new VoyageAIAPI({ apiKey: this.apiKey });
});
} catch (e) {
// @ts-ignore
if (e.code === "MODULE_NOT_FOUND") {
throw new Error(
"Please install the voyageai package to use the VoyageAIEmbeddingFunction, `npm install -S voyageai`",
);
}
throw e;
}
}
public async generate(texts: string[]): Promise<number[][]> {
await this.initClient();
// @ts-ignore
return await this.voyageAiApi.createEmbedding({
model: this.model,
input: texts,
});
}
buildFromConfig(config: StoredConfig): VoyageAIEmbeddingFunction {
return new VoyageAIEmbeddingFunction({View on GitHub (pinned to aecdd12c8a)
Solutions
- npm install voyageai (or yarn/pnpm equivalent) in the package that creates the embedding function.
- Verify resolution in the failing runtime: node -e "import('voyageai').then(m => console.log(!!m.VoyageAIAPI)).catch(e => console.error(e.code || e.message))".
- If you instead see ERR_MODULE_NOT_FOUND or a TypeError from import, it is the same missing-package cause — install it.
- Rebuild CI/Docker caches after adding the dependency.
Example fix
# before npm install chromadb # VoyageAIEmbeddingFunction used -> first add() throws install hint # after npm install chromadb voyageai
Defensive patterns
Strategy: validation
Validate before calling
try {
await import("voyageai");
} catch {
throw new Error("voyageai package missing. Run: npm install voyageai");
} Prevention
- Declare optional provider SDKs (voyageai, @xenova/transformers) explicitly in the consuming package's dependencies.
- Add a startup preflight that imports each optional SDK your active embedding functions need.
When it happens
Trigger: First collection.add()/query() using VoyageAIEmbeddingFunction without `voyageai` in dependencies; package present in the workspace root but not resolvable from the package constructing the function; buildFromConfig restoring a voyageai-configured collection on a machine without the package.
Common situations: Following Chroma docs without installing the optional provider SDK; monorepo hoisting issues; CI cache built before the dependency was added.
Related errors
- Please install the chromadb-default-embed package to use the
- Please install chromadb-default-embed as a dependency with,
- Please install the ollama package to use the OllamaEmbedding
- Please install the openai package to use the OpenAIEmbedding
- Please install the @xenova/transformers package to use the T
AI-assisted analysis of chroma-core/chroma@aecdd12c8a (2026-08-16).
Data as JSON: /api/errors/df47655db43e6f56.
Report an issue: GitHub.