[BUG] Knowledge Base kb:search fails with TypeError: Q.trim is not a function on Chatbox 1.23.5

Open
#3,971 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
52/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
typescript

Research direction

Search the project for the kb:search IPC handler and the code that builds the Knowledge Base tool arguments. Reproduce the failure using the reported Chatbox, Ollama, and Knowledge Base setup, then trace where the query becomes an object instead of a string. Done means the query reaches search as a string and the Knowledge Base search returns context without the TypeError.

Written by the indexing model from the issue text.

Description

Bug description

Knowledge Base search fails intermittently on Chatbox Desktop 1.23.5 with:

Error invoking remote method 'kb:search':
TypeError: Q.trim is not a function

The Knowledge Base is correctly created, documents are successfully parsed and chunked, and Ollama embeddings work correctly when tested independently.

However, when Chatbox attempts to search the Knowledge Base, kb:search fails before the retrieved context reaches the chat model.

Environment

Chatbox Desktop: 1.23.5

Operating system:
macOS

Hardware:
MacBook Pro Intel Core i9
16 GB RAM

Model provider:
Ollama

Ollama API Host:
http://127.0.0.1:11434

Chat model:
qwen2.5:3b

Embedding model:
nomic-embed-text

Knowledge Base parser:
Local

Rerank model:
None

Vision model:
None

Chat Mode:
Enabled

Smart Switching:
Disabled

Knowledge Base configuration

The Knowledge Base uses:

Embedding provider:
Ollama

Embedding model:
nomic-embed-text

The documents are parsed successfully and chunks are generated correctly.

Knowledge Base is explicitly selected in the Chatbox conversation.

Error shown by Chatbox

Chatbox displays:

Consult Knowledge Base - Failed

Error:

Error invoking remote method 'kb:search':
TypeError: Q.trim is not a function

Arguments shown by Chatbox

Chatbox displays this argument:

{
"query": {
"type": "string",
"value": "proyeccion ingresos totales 2027"
}
}

Expected behavior

The Knowledge Base search should receive a string query equivalent to:

{
"query": "proyeccion ingresos totales 2027"
}

and perform semantic search using the configured embedding model.

Actual behavior

The query appears to be passed as an object containing:

{
"type": "string",
"value": "..."
}

The kb:search operation then fails with:

TypeError: Q.trim is not a function

As a consequence, no retrieved Knowledge Base context reaches the chat model.

Ollama embedding test

The Ollama embedding API was tested independently with:

curl http://127.0.0.1:11434/api/embed -d '{
"model": "nomic-embed-text",
"input": "ingresos totales proyectados para 2027"
}'

The API successfully returns an embedding vector.

Therefore Ollama and nomic-embed-text appear to be working correctly.

Steps to reproduce

  1. Start Ollama locally.
  2. Configure Ollama in Chatbox with:
    http://127.0.0.1:11434
  3. Configure qwen2.5:3b as Chat model.
  4. Configure nomic-embed-text as Embedding model.
  5. Create a local Knowledge Base.
  6. Upload a TXT document.
  7. Wait until parsing and chunk generation complete successfully.
  8. Start a new Chat Mode conversation.
  9. Select the Knowledge Base.
  10. Ask a question related to the document.
  11. Expand the Knowledge Base operation.

Result:

Error invoking remote method 'kb:search':
TypeError: Q.trim is not a function

Additional observation

Some Knowledge Base searches have worked successfully when the query shown by Chatbox was a simple text value.

The failure occurs when the search argument is represented as an object containing:

type: "string"
value: "..."

This may indicate a type normalization issue between the generated Knowledge Base tool argument and the kb:search IPC handler.

Dominant language
TypeScript
Stars
42.5k
Forks
4.4k
Avg merge
11h 14m
Merged PRs (30d)
2

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from chatboxai/chatbox

All issues in chatboxai/chatbox

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.