{"record":{"id":"bbd8b6a8108c03ce","repo":"microsoft/autogen","slug":"chromadb-embedding-functions-not-available-ensure","errorCode":null,"errorMessage":"ChromaDB embedding functions not available. Ensure chromadb is properly installed.","messagePattern":"ChromaDB embedding functions not available\\. Ensure chromadb is properly installed\\.","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"critical","filePath":"python/packages/autogen-ext/src/autogen_ext/memory/chromadb/_chromadb.py","lineNumber":202,"sourceCode":"    @property\n    def collection_name(self) -> str:\n        \"\"\"Get the name of the ChromaDB collection.\"\"\"\n        return self._config.collection_name\n\n    def _create_embedding_function(self) -> Any:\n        \"\"\"Create an embedding function based on the configuration.\n\n        Returns:\n            A ChromaDB-compatible embedding function.\n\n        Raises:\n            ValueError: If the embedding function type is unsupported.\n            ImportError: If required dependencies are not installed.\n        \"\"\"\n        try:\n            from chromadb.utils import embedding_functions\n        except ImportError as e:\n            raise ImportError(\n                \"ChromaDB embedding functions not available. Ensure chromadb is properly installed.\"\n            ) from e\n\n        config = self._config.embedding_function_config\n\n        if isinstance(config, DefaultEmbeddingFunctionConfig):\n            return embedding_functions.DefaultEmbeddingFunction()\n\n        elif isinstance(config, SentenceTransformerEmbeddingFunctionConfig):\n            try:\n                return embedding_functions.SentenceTransformerEmbeddingFunction(model_name=config.model_name)\n            except Exception as e:\n                raise ImportError(\n                    f\"Failed to create SentenceTransformer embedding function with model '{config.model_name}'. \"\n                    f\"Ensure sentence-transformers is installed and the model is available. Error: {e}\"\n                ) from e\n\n        elif isinstance(config, OpenAIEmbeddingFunctionConfig):","sourceCodeStart":184,"sourceCodeEnd":220,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-ext/src/autogen_ext/memory/chromadb/_chromadb.py#L184-L220","documentation":"ChromaDBVectorMemory creates its embedding function lazily via chromadb.utils.embedding_functions; if that submodule cannot be imported (broken/partial chromadb install or a version that moved it), this ImportError is raised with the original error chained.","triggerScenarios":"Constructuring/initializing ChromaDBVectorMemory (first query or update triggers _create_embedding_function) when chromadb.utils.embedding_functions is missing or fails to import.","commonSituations":"Chromadb installed but corrupted or partially upgraded; incompatible chromadb version where the utils module moved; namespace-shadowing (a local chromadb.py file); missing transitive deps like onnxruntime for the default embedding function.","solutions":["Reinstall chromadb cleanly: pip install --force-reinstall chromadb.","Check the chained ImportError for the real missing module and install it (e.g. onnxruntime for DefaultEmbeddingFunction).","Verify with python -c \"from chromadb.utils import embedding_functions\" and remove any local chromadb.py shadow file.","Pin a known-good chromadb version compatible with your autogen-ext release."],"exampleFix":"# shell\npip install --force-reinstall chromadb\npython -c \"from chromadb.utils import embedding_functions; print('ok')\"","handlingStrategy":"validation","validationCode":"try:\n    from chromadb.utils import embedding_functions  # noqa: F401\nexcept ImportError:\n    raise SystemExit(\"chromadb install is broken; reinstall with: pip install --force-reinstall chromadb\")","typeGuard":null,"tryCatchPattern":"try:\n    memory = ChromaDBVectorMemory(config=config)\n    await memory.update_context(ctx)  # triggers lazy init\nexcept ImportError as e:\n    if \"embedding functions not available\" in str(e):\n        # reinstall/repair chromadb, then retry\n        raise SystemExit(\"Repair with: pip install --force-reinstall chromadb\") from e\n    raise","preventionTips":["Verify `from chromadb.utils import embedding_functions` in environment health checks.","Avoid partial upgrades of chromadb; upgrade atomically and pin versions.","Ensure no local file shadows the chromadb package name."],"tags":["autogen","chromadb","dependencies","import-error"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}