{"record":{"id":"5c58b7954ba846db","repo":"chroma-core/chroma","slug":"no-migration-file-found-for-dir-file-dir-with","errorCode":null,"errorMessage":"No migration file found for dir {file['dir']} with filename {file['filename']} and scope {file['scope']} at version {file['version']}","messagePattern":"No migration file found for dir (.+?) with filename (.+?) and scope (.+?) at version (.+?)","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"chromadb/db/migrations.py","lineNumber":253,"sourceCode":"def find_migrations(\n    dir: Traversable, scope: str, hash_alg: str = \"md5\"\n) -> Sequence[Migration]:\n    \"\"\"Return a list of all migration present in the given directory, in ascending\n    order. Filter by scope.\"\"\"\n    files = [\n        _parse_migration_filename(dir.name, t.name, t)\n        for t in dir.iterdir()\n        if t.name.endswith(\".sql\")\n    ]\n    files = list(filter(lambda f: f[\"scope\"] == scope, files))\n    files = sorted(files, key=lambda f: f[\"version\"])\n    return [_read_migration_file(f, hash_alg) for f in files]\n\n\ndef _read_migration_file(file: MigrationFile, hash_alg: str) -> Migration:\n    \"\"\"Read a migration file\"\"\"\n    if \"path\" not in file or not file[\"path\"].is_file():\n        raise FileNotFoundError(\n            f\"No migration file found for dir {file['dir']} with filename {file['filename']} and scope {file['scope']} at version {file['version']}\"\n        )\n    sql = file[\"path\"].read_text()\n\n    if hash_alg == \"md5\":\n        hash = (\n            hashlib.md5(sql.encode(\"utf-8\"), usedforsecurity=False).hexdigest()\n            if sys.version_info >= (3, 9)\n            else hashlib.md5(sql.encode(\"utf-8\")).hexdigest()\n        )\n    elif hash_alg == \"sha256\":\n        hash = hashlib.sha256(sql.encode(\"utf-8\")).hexdigest()\n    else:\n        raise InvalidHashError(alg=hash_alg)\n\n    return {\n        \"hash\": hash,\n        \"sql\": sql,","sourceCodeStart":235,"sourceCodeEnd":271,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/chromadb/db/migrations.py#L235-L271","documentation":"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.","triggerScenarios":"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.","commonSituations":"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'.","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())."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"from pathlib import Path\nmig_dir = Path(chromadb.__file__).parent / \"db\" / \"migrations\"\nmissing = [p for p in mig_dir.rglob(\"*.sql\") if not p.is_file()]\nassert not missing, f\"Broken install, unreadable migrations: {missing}\"","typeGuard":"def is_missing_migration_file(e: BaseException) -> bool:\n    return isinstance(e, FileNotFoundError) and \"No migration file found\" in str(e)","tryCatchPattern":"try:\n    migrate(source, db, dir, scope, hash_alg)\nexcept FileNotFoundError as e:\n    raise RuntimeError(f\"Chroma install appears broken; reinstall chromadb: {e}\") from e","preventionTips":["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'."],"tags":["chroma","migrations","packaging","file-not-found","install"],"backgroundTag":"migration-file-missing","analyzedSha":"aecdd12c8a891610db8653630b066b32ceb678b5","analyzedAt":"2026-08-16T21:53:27.228Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}