chromadb 0.5.20连接遇404错误,0.5.3正常,求解决方案
ChromaDB 0.5.20 报错
ValueError: {"detail":"Not Found"} 问题求助 使用ChromaDB 0.5.20版本时,会抛出ValueError: {"detail":"Not Found"}错误,但0.5.3版本可正常运行。希望使用更新的ChromaDB版本,求问题分析及解决方案。
连接数据库并缓存集合的函数代码
def client_formation(): """ Function to get and calling the data fetching function. :return: Returning the all source documents. """ if os.environ['ENVIRONMENT'] == "dev": collections = collection return_cache = cache else: collections = vector_collections return_cache = documents_cache for collect in collections: client_key = list(collect.keys())[0] client_data = collect[client_key] client_config = vector_db_config(client_data['tenant'], client_data['database']) if client_data['collect_1']: get_documents_from_vectorstore(client_config, client_data['collect_1'], client_data['cache_key_1']) if client_data['collect_2']: get_documents_from_vectorstore(client_config, client_data['collect_2'], client_data['cache_key_2']) return return_cache
完整报错信息
INFO:chromadb.telemetry.product.posthog:Anonymized telemetry enabled. See https://docs.trychroma.com/telemetry for more information. INFO:httpx:HTTP Request: GET https://develop/api/v2/auth/identity "HTTP/1.1 404 Not Found" Traceback (most recent call last): File "/root/.virtualenvs/power/lib/python3.10/site-packages/chromadb/api/base_http_client.py", line 99, in _raise_chroma_error resp.raise_for_status() File "/root/.virtualenvs/power/lib/python3.10/site-packages/httpx/_models.py", line 763, in raise_for_status raise HTTPStatusError(message, request=request, response=self) httpx.HTTPStatusError: Client error '404 Not Found' for url 'https://develop/api/v2/auth/identity' For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/root/.virtualenvs/power/lib/python3.10/site-packages/chromadb/api/client.py", line 101, in get_user_identity return self._server.get_user_identity() File "/root/.virtualenvs/power/lib/python3.10/site-packages/chromadb/telemetry/opentelemetry/__init__.py", line 150, in wrapper return f(*args, **kwargs) File "/root/.virtualenvs/power/lib/python3.10/site-packages/chromadb/api/fastapi.py", line 144, in get_user_identity return UserIdentity(**self._make_request("get", "/auth/identity")) File "/root/.virtualenvs/power/lib/python3.10/site-packages/chromadb/api/fastapi.py", line 90, in _make_request BaseHTTPClient._raise_chroma_error(response) File "/root/.virtualenvs/power/lib/python3.10/site-packages/chromadb/api/base_http_client.py", line 104, in _raise_chroma_error raise (Exception(resp.text)) Exception: {"detail":"Not Found"}
问题分析与解决方案思路
核心原因
报错显示客户端请求/api/v2/auth/identity接口时返回404,说明ChromaDB 0.5.20版本的客户端依赖的认证接口在当前服务端不存在。大概率是客户端与服务端版本不兼容——0.5.3到0.5.20之间,ChromaDB调整了API路由或认证机制,新版本客户端无法适配旧服务端。
可行解决方案
- 对齐服务端与客户端版本:将ChromaDB服务端升级到0.5.20版本,确保客户端和服务端版本一致,避免API不匹配问题。
- 检查客户端配置:确认
vector_db_config生成的配置是否正确,包括服务端地址、认证参数等。新版本可能要求不同的路由前缀或认证方式,需对应调整。 - 跳过身份验证请求:如果服务端未启用认证,尝试在客户端初始化时添加配置项,跳过身份验证相关的接口调用。
- 排查版本变更日志:对比ChromaDB 0.5.3到0.5.20的版本变更记录,重点关注API接口、认证逻辑的改动,针对性修改代码适配新版本。
内容的提问来源于stack exchange,提问作者Jokin Prabhu
相关产品推荐
相关产品推荐

