这是indexloc提供的服务,不要输入任何密码
Skip to content

[BUG]: TypeError: tokenizer is not a function #4032

@noelmateng

Description

@noelmateng

How are you running AnythingLLM?

Docker (local)

What happened?

Getting this error when running multiple queries concurrently.

2025-06-23 11:05:29 [backend] error: TypeError: tokenizer is not a function
2025-06-23 11:05:29     at NativeEmbeddingReranker.rerank (/app/server/utils/EmbeddingRerankers/native/index.js:215:20)
2025-06-23 11:05:29     at async Object.rerankedSimilarityResponse (/app/server/utils/vectorDbProviders/lance/index.js:114:5)
2025-06-23 11:05:29     at async Object.performSimilaritySearch (/app/server/utils/vectorDbProviders/lance/index.js:405:9)
2025-06-23 11:05:29     at async Object.chatSync (/app/server/utils/chats/apiChatHandler.js:213:9)
2025-06-23 11:05:29     at async /app/server/endpoints/api/workspace/index.js:681:24
2025-06-23 11:05:29 [backend] error: LanceDB::rerankedSimilarityResponse tokenizer is not a function

This results in the sources being returned as empty array.

Based on my analysis,

The issue seems to be due to this assignment here.
I think when we run multiple queries concurrently, the NativeEmbeddingReranker.#transformers gets set in the first query (api call) while the second query exits from here

This causes the tokenizer here to be undefined here
and we get the error: TypeError: tokenizer is not a function

Are there known steps to reproduce?

  1. Run anything labs locally on docker

  2. Use default system embedding model

  3. Load some documents into your workspace

  4. Run multiple chats in query mode in parallel. My concurrency was 2.

Metadata

Metadata

Assignees

Labels

investigatingCore team or maintainer will or is currently looking into this issueneeds info / can't replicateIssues that require additional information and/or cannot currently be replicated, but possible bugpossible bugBug was reported but is not confirmed or is unable to be replicated.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions