Mintplex-Labs / anything-llm

The all-in-one Desktop & Docker AI application with full RAG and AI Agent capabilities.
https://anythingllm.com
MIT License
19.22k stars 2.1k forks source link

[BUG]: Error: 1 documents failed to add #1481

Closed git2306 closed 3 months ago

git2306 commented 3 months ago

How are you running AnythingLLM?

AnythingLLM desktop app

What happened?

I use AnythingLLM Desktop 1.5.5, LLM Provider: Gemini, Grok, Ollama (local host).... Embedding Provider: Ollama (local host ) , Model: nomic-embed-text:latest Vector Database: Chroma (run in docker), http://127.0.0.1:8000

It has been used normally for a few days, including uploading my document and embed to Chroma One day when I changed Ollama's Embedding Model to another Model, I got the following error

 Error: 1 documents failed to add

ValueError('Expected collection name that
 (1) contains 3-63 characters,
(2) starts and ends with an alphanumeric character,
(3) otherwise contains only alphanumeric characters, underscores or hyphens(-),
(4) contains no two consecutive periods (..) and 
(5) is not a valid IPv4 address, got 1') 

Then change it back to nomic-embed-text:latest from other embed models, or even reinstall AnythingLLM, Ollama, and Chroma, and I will get the same error.

The Chroma Docker Log :

024-05-22 16:57:25 INFO: [22-05-2024 08:57:25] 172.17.0.1:56764 - "GET /api/v1/heartbeat HTTP/1.1" 200 2024-05-22 16:57:25 ERROR: [22-05-2024 08:57:25] Expected collection name that (1) contains 3-63 characters, (2) starts and ends with an alphanumeric character, (3) otherwise contains only alphanumeric characters, underscores or hyphens (-), (4) contains no two consecutive periods (..) and (5) is not a valid IPv4 address, got 11 2024-05-22 16:57:25 Traceback (most recent call last): 2024-05-22 16:57:25 File "/usr/local/lib/python3.11/site-packages/anyio/streams/memory.py", line 97, in receive 2024-05-22 16:57:25 return self.receive_nowait() 2024-05-22 16:57:25 ^^^^^^^^^^^^^^^^^^^^^ 2024-05-22 16:57:25 File "/usr/local/lib/python3.11/site-packages/anyio/streams/memory.py", line 92, in receive_nowait 2024-05-22 16:57:25 raise WouldBlock 2024-05-22 16:57:25 anyio.WouldBlock 2024-05-22 16:57:25 2024-05-22 16:57:25 During handling of the above exception, another exception occurred: 2024-05-22 16:57:25 2024-05-22 16:57:25 Traceback (most recent call last): 2024-05-22 16:57:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 159, in call_next 2024-05-22 16:57:25 message = await recv_stream.receive() 2024-05-22 16:57:25 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-05-22 16:57:25 File "/usr/local/lib/python3.11/site-packages/anyio/streams/memory.py", line 112, in receive 2024-05-22 16:57:25 raise EndOfStream 2024-05-22 16:57:25 anyio.EndOfStream 2024-05-22 16:57:25 2024-05-22 16:57:25 During handling of the above exception, another exception occurred: 2024-05-22 16:57:25 2024-05-22 16:57:25 Traceback (most recent call last): 2024-05-22 16:57:25 File "/chroma/chromadb/server/fastapi/init.py", line 78, in catch_exceptions_middleware 2024-05-22 16:57:25 return await call_next(request) 2024-05-22 16:57:25 ^^^^^^^^^^^^^^^^^^^^^^^^ 2024-05-22 16:57:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next 2024-05-22 16:57:25 raise app_exc 2024-05-22 16:57:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro 2024-05-22 16:57:25 await self.app(scope, receive_or_disconnect, send_no_error) 2024-05-22 16:57:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in call 2024-05-22 16:57:25 with collapse_excgroups(): 2024-05-22 16:57:25 File "/usr/local/lib/python3.11/contextlib.py", line 158, in exit 2024-05-22 16:57:25 self.gen.throw(typ, value, traceback) 2024-05-22 16:57:25 File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups 2024-05-22 16:57:25 raise exc 2024-05-22 16:57:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in call 2024-05-22 16:57:25 response = await self.dispatch_func(request, call_next) 2024-05-22 16:57:25 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-05-22 16:57:25 File "/chroma/chromadb/server/fastapi/init.py", line 92, in check_http_version_middleware 2024-05-22 16:57:25 return await call_next(request) 2024-05-22 16:57:25 ^^^^^^^^^^^^^^^^^^^^^^^^ 2024-05-22 16:57:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next 2024-05-22 16:57:25 raise app_exc 2024-05-22 16:57:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro 2024-05-22 16:57:25 await self.app(scope, receive_or_disconnect, send_no_error) 2024-05-22 16:57:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 65, in call 2024-05-22 16:57:25 await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) 2024-05-22 16:57:25 File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app 2024-05-22 16:57:25 raise exc 2024-05-22 16:57:25 File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app 2024-05-22 16:57:25 await app(scope, receive, sender) 2024-05-22 16:57:25 File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 756, in call 2024-05-22 16:57:25 await self.middleware_stack(scope, receive, send) 2024-05-22 16:57:25 File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 776, in app 2024-05-22 16:57:25 await route.handle(scope, receive, send) 2024-05-22 16:57:25 File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 297, in handle 2024-05-22 16:57:25 await self.app(scope, receive, send) 2024-05-22 16:57:25 File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 77, in app 2024-05-22 16:57:25 await wrap_app_handling_exceptions(app, request)(scope, receive, send) 2024-05-22 16:57:25 File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app 2024-05-22 16:57:25 raise exc 2024-05-22 16:57:25 File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app 2024-05-22 16:57:25 await app(scope, receive, sender) 2024-05-22 16:57:25 File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 72, in app 2024-05-22 16:57:25 response = await func(request) 2024-05-22 16:57:25 ^^^^^^^^^^^^^^^^^^^ 2024-05-22 16:57:25 File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 278, in app 2024-05-22 16:57:25 raw_response = await run_endpoint_function( 2024-05-22 16:57:25 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-05-22 16:57:25 File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 191, in run_endpoint_function 2024-05-22 16:57:25 return await dependant.call(*values) 2024-05-22 16:57:25 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-05-22 16:57:25 File "/chroma/chromadb/telemetry/opentelemetry/init.py", line 130, in wrapper 2024-05-22 16:57:25 return await f(args, kwargs) 2024-05-22 16:57:25 ^^^^^^^^^^^^^^^^^^^^^^^^ 2024-05-22 16:57:25 File "/chroma/chromadb/server/fastapi/init.py", line 630, in create_collection 2024-05-22 16:57:25 await to_thread.run_sync( 2024-05-22 16:57:25 File "/usr/local/lib/python3.11/site-packages/anyio/to_thread.py", line 56, in run_sync 2024-05-22 16:57:25 return await get_async_backend().run_sync_in_worker_thread( 2024-05-22 16:57:25 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-05-22 16:57:25 File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 2144, in run_sync_in_worker_thread 2024-05-22 16:57:25 return await future 2024-05-22 16:57:25 ^^^^^^^^^^^^ 2024-05-22 16:57:25 File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 851, in run 2024-05-22 16:57:25 result = context.run(func, args) 2024-05-22 16:57:25 ^^^^^^^^^^^^^^^^^^^^^^^^ 2024-05-22 16:57:25 File "/chroma/chromadb/server/fastapi/init.py", line 620, in process_create_collection 2024-05-22 16:57:25 return self._api.create_collection( 2024-05-22 16:57:25 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-05-22 16:57:25 File "/chroma/chromadb/telemetry/opentelemetry/init.py", line 143, in wrapper 2024-05-22 16:57:25 return f(args, kwargs) 2024-05-22 16:57:25 ^^^^^^^^^^^^^^^^^^ 2024-05-22 16:57:25 File "/chroma/chromadb/api/segment.py", line 169, in create_collection 2024-05-22 16:57:25 check_index_name(name) 2024-05-22 16:57:25 File "/chroma/chromadb/api/segment.py", line 79, in check_index_name 2024-05-22 16:57:25 raise ValueError(msg) 2024-05-22 16:57:25 ValueError: Expected collection name that (1) contains 3-63 characters, (2) starts and ends with an alphanumeric character, (3) otherwise contains only alphanumeric characters, underscores or hyphens (-), (4) contains no two consecutive periods (..) and (5) is not a valid IPv4 address, got 11 2024-05-22 16:57:25 INFO: [22-05-2024 08:57:25] 172.17.0.1:56768 - "POST /api/v1/collections?tenant=default_tenant&database=default_database HTTP/1.1" 500

Are there known steps to reproduce?

No response

timothycarambat commented 3 months ago
 Error: 1 documents failed to add

ValueError('Expected collection name that
 (1) contains 3-63 characters,
(2) starts and ends with an alphanumeric character,
(3) otherwise contains only alphanumeric characters, underscores or hyphens(-),
(4) contains no two consecutive periods (..) and 
(5) is not a valid IPv4 address, got 1') 

What is the name of your workspace? Seems like you have characters that it does not like? We simply slug the display name you give, so if there are illegal chars for Chroma it will throw a fit and that collection will then be unable to referenced

timothycarambat commented 3 months ago

Ah, is your workspace name just the text 11? Chroma apparently now has a 3-char minimum on workspace names. We used to enforce a minimum length but some people didn't like that and it was not required, so we removed it.

Make a workspace that is at least 3 chars long when using chroma as apparently the latest version enforces that.