Chroma JS Client Fails in Next.js (Build Error)
Quick answer
The default embedding function uses @huggingface/transformers, which Next.js cannot bundle. Wrap your config with withChroma.
Most likely fix: Wrap the config
How to fix it
Try these in order — the most common fix is first.
1. Wrap the config
- Open next.config.ts
- import { withChroma } from "chromadb"
- export default withChroma(nextConfig)
Did this fix it?
Symptoms
Build or runtime failures when importing the chromadb JS client in a Next.js project.
Why it happens
- Next.js fails to bundle @huggingface/transformers used by the default embedding function
This guide also covers
- chromadb nextjs error
- chroma js client next.js build
Still not working?
If Chroma keeps failing, you're not alone. See every Chroma problem users report or the alternatives people switch to.
Have an app idea? Our small team builds any software: web and mobile apps, games, desktop, AI tools. Price agreed together.
Talk to usOther Chroma errors
- Chroma "Your system has an unsupported version of sqlite3" Error
- Chroma InvalidDimensionException: Embedding Dimension Does Not Match Collection
- Chroma pip install "Failed to build hnswlib" Error
- Chroma Data Disappears After Restart (Persistence Fix)
- Chroma "Collection Not Found" Error
- Chroma "Collection Already Exists" UniqueConstraintError
- Chroma "sqlite3.OperationalError: database is locked"
- Chroma "Could not connect to tenant default_tenant" Error