# ChromaDB Doctor: Fix Lost Vectors & Embedding Errors

> Finds why your Chroma-backed RAG app loses data, throws dimension errors, or returns duplicate or empty results, then fixes it and proves it with a query.

ChromaDB Doctor: Fix Lost Vectors & Embedding Errors is a free AI agent skill on Agensi by Abhineet Sharma, in LLM Ops. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: Free
- Creator: [Abhineet Sharma](https://www.agensi.io/creators/abhineet-sharma)
- Category: [LLM Ops](https://www.agensi.io/skills/llm-ops)
- Version: 1.0
- Last updated: 2026-11-28
- Security: scan passed (2026-11-28); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/chromadb-doctor-fix-lost-vectors-embedding-errors
- Tags: data-databases, llm-ops, testing-debugging

## About this skill

Your RAG chatbot worked yesterday. Today it returns nothing, returns the same chunk five times, or throws **"Collection expecting embedding with dimension of 1536, got 384"**. This skill finds the real cause instead of guessing.

It ships a read-only checker that does two things:

**Scans your code** for the mistakes behind most Chroma bugs:
- **Data that doesn't survive.** In-memory `chromadb.Client()`, relative paths that change with the working directory, and hardcoded paths on container disks (Railway, Render, Fly, Docker) that get wiped on every redeploy.
- **Embedding mismatches.** Collections opened without the embedding function they were built with, and the silent fallback to Chroma's default 384-dim model (which also downloads ~80 MB at runtime and breaks offline containers).
- **Duplicate floods.** Random `uuid4` IDs plus `add()`, or `Chroma.from_documents()` on every startup, re-ingesting the whole corpus each run.
- **Wrong metric.** Collections stuck on L2 when your embeddings want cosine (fixed at creation, so it tells you how to migrate).
- **Multi-worker setups** where 4 gunicorn workers each hold their own PersistentClient on one folder.
- **LangChain breakage.** Deprecated imports, removed `.persist()`, and the default `"langchain"` collection name that makes retrievers return `[]` with no error.
- **SQLite < 3.35**, a missing `pysqlite3` swap, and unpinned `chromadb` versions that migrate your data on the next build.

**Inspects your persisted database** without importing chromadb or writing anything: every collection's count, vector dimension, distance metric, recorded embedding function, and exact-duplicate texts. It catches things code review can't, like a 1536-dim collection registered with the 384-dim default model.

It includes an error-signature reference (real Chroma 1.x error strings mapped to causes) and tested fix recipes: volume setup per platform, deterministic IDs with upsert, a dedupe script, a no-re-embed migration to cosine, and a Chroma server setup for multi-worker apps. Every fix ends with a known-answer query, a count check, and a restart test, so you get proof, not a suggestion.

## Requires

- Python 3.9+
- Optional: chromadb (to apply and verify fixes)

## Known limitations

Local/persistent Chroma only: it can't inspect Chroma Cloud or a remote Chroma server's data (code scanning still works). Static code checks are heuristics and can miss unusual setups. Doesn't fix retrieval quality problems caused by chunking or prompts, and doesn't migrate you to another vector database.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the ChromaDB Doctor: Fix Lost Vectors & Embedding Errors skill from Agensi" and describe your task.
3. Your agent loads the skill from Agensi when it needs it. Nothing is downloaded.

## Frequently asked questions

### Will it modify or migrate my database?

Not during diagnosis. The checker opens chroma.sqlite3 read-only and never imports chromadb, so no schema migration can run. Fixes that touch data (dedupe, metric migration) are only run after you agree, and after a backup of the persist folder.

### Does it work with LangChain?

Yes. It checks langchain / langchain_community / langchain_chroma usage, including the default 'langchain' collection name, removed .persist() calls and from_documents re-ingestion.

### Which Chroma versions?

The database inspector reads the on-disk format from 0.4 through 1.x and tolerates schema differences. It was tested against Chroma 1.5. Pre-0.4 DuckDB databases are detected and pointed at chroma-migrate.

### My data is on Railway. Can it see it?

If you can run the checker inside the service (railway ssh / run) or copy the persist folder down, yes. Otherwise it scans your code and tells you whether the data could survive a deploy at all.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
