Skip to content

[Bug]: KeyError: _type in api/configuration.py:209 #4380

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ara-arowana opened this issue Apr 25, 2025 · 3 comments
Open

[Bug]: KeyError: _type in api/configuration.py:209 #4380

ara-arowana opened this issue Apr 25, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@ara-arowana
Copy link

What happened?

When trying to upload a document to OpenWebUI (which is connected to a chromaDB), I get the error shown below. It appears to be an issue with ChromaDB, so I decided to file the issue here.

The full response fo the HTTP request is as follows:

dockeruser@hostname:~/.config/systemd/user$ curl -f http://localhost:8000/api/v2/tenants/default_tenant/databases/default_database/collections
[{"id":"73425857-9b70-4a96-a631-ba80b09272f5","name":"file-f5486ba8-fcdc-4ef1-8bd5-b15f15605697","configuration_json":{"hnsw":{"space":"cosine","ef_construction":100,"ef_search":100,"max_neighbors":16,"resize_factor":1.2,"sync_threshold":1000},"spann":null,"embedding_function":null},"metadata":{"hnsw:space":"cosine"},"dimension":null,"tenant":"default_tenant","database":"default_database","log_position":0,"version":0}]

Let me know if I can provide any further data about this.

Versions

Chroma v1.0.0 (latest docker image)
OpenWebUI v0.6.5

Relevant log output

Apr 25 13:23:51 hostname docker[2282055]: open-webui  | 2025-04-25 11:23:51.347 | ERROR    | open_webui.routers.retrieval:save_docs_to_vector_db:945 - '_type' - {}
Apr 25 13:23:51 hostname docker[2282055]: open-webui  | Traceback (most recent call last):
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |   File "/usr/local/lib/python3.11/threading.py", line 1002, in _bootstrap
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |     self._bootstrap_inner()
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |     │    └ <function Thread._bootstrap_inner at 0x7f517c520860>
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |<WorkerThread(AnyIO worker thread, started 139985107805888)>
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |   File "/usr/local/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |     self.run()
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |     │    └ <function WorkerThread.run at 0x7f50dd8bff60>
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |<WorkerThread(AnyIO worker thread, started 139985107805888)>
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |   File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 967, in run
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |     result = context.run(func, *args)
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |              │       │   │       ()
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |              │       │   └ functools.partial(<function add_file_to_knowledge_by_id at 0x7f5127ffda80>, user=UserModel(id='035539ed-55e0-46ac-afea-846a34...
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |              │       └ <method 'run' of '_contextvars.Context' objects>
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |              └ <_contextvars.Context object at 0x7f50dd93ff80>
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |   File "/app/backend/open_webui/routers/knowledge.py", line 359, in add_file_to_knowledge_by_id
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |     process_file(
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |     └ <function process_file at 0x7f5127f447c0>
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |   File "/app/backend/open_webui/routers/retrieval.py", line 1083, in process_file
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |     result = save_docs_to_vector_db(
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |              └ <function save_docs_to_vector_db at 0x7f5127f07ce0>
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |
Apr 25 13:23:51 hostname docker[2282055]: open-webui  | > File "/app/backend/open_webui/routers/retrieval.py", line 892, in save_docs_to_vector_db
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |     if VECTOR_DB_CLIENT.has_collection(collection_name=collection_name):
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |        │                │                              └ '20346f8d-7813-49e5-9b31-6f93075e6e68'
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |        │                └ <function ChromaClient.has_collection at 0x7f512f938220>
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |        └ <open_webui.retrieval.vector.dbs.chroma.ChromaClient object at 0x7f512f8ce5d0>
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |   File "/app/backend/open_webui/retrieval/vector/dbs/chroma.py", line 59, in has_collection
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |     collection_names = self.client.list_collections()
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |                        │    │      └ <function Client.list_collections at 0x7f5132510e00>
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |                        │    └ <chromadb.api.client.Client object at 0x7f512f8cee50>
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |                        └ <open_webui.retrieval.vector.dbs.chroma.ChromaClient object at 0x7f512f8ce5d0>
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |   File "/usr/local/lib/python3.11/site-packages/chromadb/api/client.py", line 124, in list_collections
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |     for model in self._server.list_collections(
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |                  │    │       └ <function FastAPI.list_collections at 0x7f512f7ebb00>
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |                  │    └ <chromadb.api.fastapi.FastAPI object at 0x7f512f90ec10>
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |                  └ <chromadb.api.client.Client object at 0x7f512f8cee50>
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |   File "/usr/local/lib/python3.11/site-packages/chromadb/telemetry/opentelemetry/__init__.py", line 150, in wrapper
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |     return f(*args, **kwargs)
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |            │  │       └ {'tenant': 'default_tenant', 'database': 'default_database'}
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |            │  └ (<chromadb.api.fastapi.FastAPI object at 0x7f512f90ec10>, None, None)
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |            └ <function FastAPI.list_collections at 0x7f512f7eba60>
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |   File "/usr/local/lib/python3.11/site-packages/chromadb/api/fastapi.py", line 204, in list_collections
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |     collection_models = [
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |   File "/usr/local/lib/python3.11/site-packages/chromadb/api/fastapi.py", line 205, in <listcomp>
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |     CollectionModel.from_json(json_collection)
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |     │               │         └ {'id': '73425857-9b70-4a96-a631-ba80b09272f5', 'name': 'file-f5486ba8-fcdc-4ef1-8bd5-b15f15605697', 'configuration_json': {'h...
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |     │               └ <classmethod(<function Collection.from_json at 0x7f513267ba60>)>
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |<class 'chromadb.types.Collection'>
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |   File "/usr/local/lib/python3.11/site-packages/chromadb/types.py", line 156, in from_json
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |     configuration = CollectionConfigurationInternal.from_json(
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |                     │                               └ <classmethod(<function ConfigurationInternal.from_json at 0x7f51329398a0>)>
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |<class 'chromadb.api.configuration.CollectionConfigurationInternal'>
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |   File "/usr/local/lib/python3.11/site-packages/chromadb/api/configuration.py", line 209, in from_json
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |     f"Trying to instantiate configuration of type {cls.__name__} from JSON with type {json_map['_type']}"
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |
Apr 25 13:23:51 hostname docker[2282055]: open-webui  | KeyError: '_type'
Apr 25 13:23:51 hostname docker[2282055]: open-webui  | 2025-04-25 11:23:51.348 | ERROR    | open_webui.routers.retrieval:process_file:1121 - '_type' - {}
Apr 25 13:23:51 hostname docker[2282055]: open-webui  | Traceback (most recent call last):
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |   File "/usr/local/lib/python3.11/threading.py", line 1002, in _bootstrap
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |     self._bootstrap_inner()
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |     │    └ <function Thread._bootstrap_inner at 0x7f517c520860>
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |<WorkerThread(AnyIO worker thread, started 139985107805888)>
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |   File "/usr/local/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |     self.run()
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |     │    └ <function WorkerThread.run at 0x7f50dd8bff60>
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |<WorkerThread(AnyIO worker thread, started 139985107805888)>
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |   File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 967, in run
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |     result = context.run(func, *args)
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |              │       │   │       ()
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |              │       │   └ functools.partial(<function add_file_to_knowledge_by_id at 0x7f5127ffda80>, user=UserModel(id='035539ed-55e0-46ac-afea-846a34...
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |              │       └ <method 'run' of '_contextvars.Context' objects>
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |              └ <_contextvars.Context object at 0x7f50dd93ff80>
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |   File "/app/backend/open_webui/routers/knowledge.py", line 359, in add_file_to_knowledge_by_id
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |     process_file(
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |     └ <function process_file at 0x7f5127f447c0>
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |
Apr 25 13:23:51 hostname docker[2282055]: open-webui  | > File "/app/backend/open_webui/routers/retrieval.py", line 1111, in process_file
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |     raise e
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |           └ KeyError('_type')
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |   File "/app/backend/open_webui/routers/retrieval.py", line 1083, in process_file
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |     result = save_docs_to_vector_db(
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |              └ <function save_docs_to_vector_db at 0x7f5127f07ce0>
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |   File "/app/backend/open_webui/routers/retrieval.py", line 946, in save_docs_to_vector_db
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |     raise e
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |   File "/app/backend/open_webui/routers/retrieval.py", line 892, in save_docs_to_vector_db
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |     if VECTOR_DB_CLIENT.has_collection(collection_name=collection_name):
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |        │                │                              └ '20346f8d-7813-49e5-9b31-6f93075e6e68'
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |        │                └ <function ChromaClient.has_collection at 0x7f512f938220>
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |        └ <open_webui.retrieval.vector.dbs.chroma.ChromaClient object at 0x7f512f8ce5d0>
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |   File "/app/backend/open_webui/retrieval/vector/dbs/chroma.py", line 59, in has_collection
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |     collection_names = self.client.list_collections()
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |                        │    │      └ <function Client.list_collections at 0x7f5132510e00>
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |                        │    └ <chromadb.api.client.Client object at 0x7f512f8cee50>
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |                        └ <open_webui.retrieval.vector.dbs.chroma.ChromaClient object at 0x7f512f8ce5d0>
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |   File "/usr/local/lib/python3.11/site-packages/chromadb/api/client.py", line 124, in list_collections
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |     for model in self._server.list_collections(
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |                  │    │       └ <function FastAPI.list_collections at 0x7f512f7ebb00>
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |                  │    └ <chromadb.api.fastapi.FastAPI object at 0x7f512f90ec10>
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |                  └ <chromadb.api.client.Client object at 0x7f512f8cee50>
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |   File "/usr/local/lib/python3.11/site-packages/chromadb/telemetry/opentelemetry/__init__.py", line 150, in wrapper
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |     return f(*args, **kwargs)
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |            │  │       └ {'tenant': 'default_tenant', 'database': 'default_database'}
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |            │  └ (<chromadb.api.fastapi.FastAPI object at 0x7f512f90ec10>, None, None)
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |            └ <function FastAPI.list_collections at 0x7f512f7eba60>
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |   File "/usr/local/lib/python3.11/site-packages/chromadb/api/fastapi.py", line 204, in list_collections
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |     collection_models = [
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |   File "/usr/local/lib/python3.11/site-packages/chromadb/api/fastapi.py", line 205, in <listcomp>
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |     CollectionModel.from_json(json_collection)
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |     │               │         └ {'id': '73425857-9b70-4a96-a631-ba80b09272f5', 'name': 'file-f5486ba8-fcdc-4ef1-8bd5-b15f15605697', 'configuration_json': {'h...
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |     │               └ <classmethod(<function Collection.from_json at 0x7f513267ba60>)>
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |<class 'chromadb.types.Collection'>
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |   File "/usr/local/lib/python3.11/site-packages/chromadb/types.py", line 156, in from_json
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |     configuration = CollectionConfigurationInternal.from_json(
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |                     │                               └ <classmethod(<function ConfigurationInternal.from_json at 0x7f51329398a0>)>
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |<class 'chromadb.api.configuration.CollectionConfigurationInternal'>
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |   File "/usr/local/lib/python3.11/site-packages/chromadb/api/configuration.py", line 209, in from_json
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |     f"Trying to instantiate configuration of type {cls.__name__} from JSON with type {json_map['_type']}"
Apr 25 13:23:51 hostname docker[2282055]: open-webui  |
Apr 25 13:23:51 hostname docker[2282055]: open-webui  | KeyError: '_type'
Apr 25 13:23:51 hostname docker[2282055]: open-webui  | 2025-04-25 11:23:51.349 | INFO     | uvicorn.protocols.http.httptools_impl:send:476 - 172.17.16.91:0 - "POST /api/v1/knowledge/20346f8d-7813-49e5-9b31-6f93075e6e68/file/add HTTP/1.1" 400 - {}
@ara-arowana ara-arowana added the bug Something isn't working label Apr 25, 2025
@aryanranderiya
Copy link

Image

i'm having the same issue

@osamaoam
Copy link

After updating chroma update all the dependecies it has.

@jairad26
Copy link
Contributor

jairad26 commented Apr 25, 2025

Hi, as part of 1.0.7, the dockerfile has been updated to run against the upgraded Rust implementation of chromadb, which requires an upgrade to the python client. What version of the python client are you running? could you try upgrading to latest, 1.0.7?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants