chroma-core/chroma · error · FileNotFoundError
No migration file found for dir {file['dir']} with filename
Error message
No migration file found for dir {file['dir']} with filename {file['filename']} and scope {file['scope']} at version {file['version']} What it means
Raised while reading a migration entry that was discovered on disk: the parsed MigrationFile has no usable 'path' or the path is not a real file, so its SQL cannot be read (chromadb/db/migrations.py:253). It is a plain builtin FileNotFoundError, not a ChromaError. In practice the directory listing saw the .sql file but it cannot be opened as a filesystem file.
Source
Thrown at chromadb/db/migrations.py:253
def find_migrations(
dir: Traversable, scope: str, hash_alg: str = "md5"
) -> Sequence[Migration]:
"""Return a list of all migration present in the given directory, in ascending
order. Filter by scope."""
files = [
_parse_migration_filename(dir.name, t.name, t)
for t in dir.iterdir()
if t.name.endswith(".sql")
]
files = list(filter(lambda f: f["scope"] == scope, files))
files = sorted(files, key=lambda f: f["version"])
return [_read_migration_file(f, hash_alg) for f in files]
def _read_migration_file(file: MigrationFile, hash_alg: str) -> Migration:
"""Read a migration file"""
if "path" not in file or not file["path"].is_file():
raise FileNotFoundError(
f"No migration file found for dir {file['dir']} with filename {file['filename']} and scope {file['scope']} at version {file['version']}"
)
sql = file["path"].read_text()
if hash_alg == "md5":
hash = (
hashlib.md5(sql.encode("utf-8"), usedforsecurity=False).hexdigest()
if sys.version_info >= (3, 9)
else hashlib.md5(sql.encode("utf-8")).hexdigest()
)
elif hash_alg == "sha256":
hash = hashlib.sha256(sql.encode("utf-8")).hexdigest()
else:
raise InvalidHashError(alg=hash_alg)
return {
"hash": hash,
"sql": sql,View on GitHub (pinned to aecdd12c8a)
Solutions
- Reinstall the package cleanly (pip install --force-reinstall chromadb==<version>) to restore a complete migrations directory.
- If running from a zip/frozen bundle, unpack it or ensure the migrations package ships as real files on disk.
- Verify the migrations directory in site-packages lists and opens every .sql file (e.g. loop over them with open()).
Defensive patterns
Strategy: try-catch
Validate before calling
from pathlib import Path
mig_dir = Path(chromadb.__file__).parent / "db" / "migrations"
missing = [p for p in mig_dir.rglob("*.sql") if not p.is_file()]
assert not missing, f"Broken install, unreadable migrations: {missing}" Type guard
def is_missing_migration_file(e: BaseException) -> bool:
return isinstance(e, FileNotFoundError) and "No migration file found" in str(e) Try / catch
try:
migrate(source, db, dir, scope, hash_alg)
except FileNotFoundError as e:
raise RuntimeError(f"Chroma install appears broken; reinstall chromadb: {e}") from e Prevention
- Install chromadb from wheels; avoid zipapp/egg packaging for it.
- Reinstall the exact pinned version if migrations ever fail to read.
- Don't delete files under site-packages/chromadb to 'save space'.
When it happens
Trigger: Migration files are loaded from a non-filesystem Traversable (e.g. a zip import via importlib.resources) where the entry has no real file path; a migration .sql file was deleted between directory listing and read; a broken/partial package install where filenames are present but files are truncated or missing.
Common situations: Running chromadb from a zipped egg/zipapp or a frozen environment without proper filesystem access to the migrations package; interrupted pip install or a corrupted site-packages; read-only or overlay filesystems where is_file() behaves unexpectedly; deleting files out of an active install to 'clean up'.
Related errors
- Inconsistent hashes in {path}:db hash was {db_hash}, source
- Invalid hash algorithm specified: {alg}
- Embedding function provided when already defined in the coll
- Aggregate input must be an Aggregate instance or object with
- MinK keys cannot be empty
AI-assisted analysis of chroma-core/chroma@aecdd12c8a (2026-08-16).
Data as JSON: /api/errors/5c58b7954ba846db.
Report an issue: GitHub.