Knowledge query text limit #20978

Closed
opened 2026-02-21 20:10:05 -05:00 by yindo · 3 comments
Owner

Originally created by @DavideDelbianco on GitHub (Dec 11, 2025).

Originally assigned to: @JohnJyong on GitHub.

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.11.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Go to the hit test page for a Knowledge

✔️ Expected Behavior

There should be no limit since the API has no limit.
Unless you added a constrain in the DB column to be 200 characters, in that case it would cause major issue since the KB Retrieval node logs in the same table and has no characters limit.

Actual Behavior

v 1.9.1

Image

v 1.11.0

Image
Originally created by @DavideDelbianco on GitHub (Dec 11, 2025). Originally assigned to: @JohnJyong on GitHub. ### Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report, otherwise it will be closed. - [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.11.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce Go to the hit test page for a Knowledge ### ✔️ Expected Behavior There should be no limit since the API has no limit. Unless you added a constrain in the DB column to be 200 characters, in that case it would cause major issue since the KB Retrieval node logs in the same table and has no characters limit. ### ❌ Actual Behavior v 1.9.1 <img width="938" height="400" alt="Image" src="https://github.com/user-attachments/assets/00d4a9a3-6b9b-4b45-81a4-c854c4ab2be2" /> v 1.11.0 <img width="857" height="223" alt="Image" src="https://github.com/user-attachments/assets/d9449794-fbd5-4c81-8812-90eebf1d043f" />
yindo added the Knowledge Pipeline label 2026-02-21 20:10:05 -05:00
yindo closed this issue 2026-02-21 20:10:05 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Dec 11, 2025):

The 200-character limit you see in the Retrieval Test UI is enforced on the frontend—the "Test" button is disabled if your input exceeds 200 characters. The backend allows queries up to 250 characters and will reject anything longer with a validation error. The database itself does not impose a character limit, as it uses a LongText column for storing queries, so there’s no risk of truncation or errors at that layer.

If you want to increase or remove the frontend limit, update the logic in the React component at web/app/components/datasets/hit-testing/components/query-input/index.tsx—specifically, change the condition that disables the button when text.length > 200 (source).

To adjust the backend limit, modify the hit_testing_args_check method in api/services/hit_testing_service.py, which currently enforces a 250-character maximum (source).

No changes are needed to the database schema for longer queries (source). For best results, keep the frontend and backend limits in sync to avoid confusing users.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Dec 11, 2025): <!-- Answer --> The 200-character limit you see in the Retrieval Test UI is enforced on the frontend—the "Test" button is disabled if your input exceeds 200 characters. The backend allows queries up to 250 characters and will reject anything longer with a validation error. The database itself does not impose a character limit, as it uses a LongText column for storing queries, so there’s no risk of truncation or errors at that layer. If you want to increase or remove the frontend limit, update the logic in the React component at `web/app/components/datasets/hit-testing/components/query-input/index.tsx`—specifically, change the condition that disables the button when `text.length > 200` ([source](https://github.com/langgenius/dify/blob/063b39ada56e0ad1a89559d3466fa82fd372cc6c/web/app/components/datasets/hit-testing/components/query-input/index.tsx#L108-L201)). To adjust the backend limit, modify the `hit_testing_args_check` method in `api/services/hit_testing_service.py`, which currently enforces a 250-character maximum ([source](https://github.com/langgenius/dify/blob/063b39ada56e0ad1a89559d3466fa82fd372cc6c/api/services/hit_testing_service.py#L28-L189)). No changes are needed to the database schema for longer queries ([source](https://github.com/langgenius/dify/blob/063b39ada56e0ad1a89559d3466fa82fd372cc6c/api/models/dataset.py#L983-L1095)). For best results, keep the frontend and backend limits in sync to avoid confusing users. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/4e33d7e7-8bc3-4bbf-aef8-518ca0eb030a?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/4e33d7e7-8bc3-4bbf-aef8-518ca0eb030a?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/4e33d7e7-8bc3-4bbf-aef8-518ca0eb030a?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/4e33d7e7-8bc3-4bbf-aef8-518ca0eb030a?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/4e33d7e7-8bc3-4bbf-aef8-518ca0eb030a?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/4e33d7e7-8bc3-4bbf-aef8-518ca0eb030a?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/4e33d7e7-8bc3-4bbf-aef8-518ca0eb030a?feedback_type=other)</sup> [![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=The%20200-character%20limit%20you%20see%20in%20the%20Retrieval%20Test%20UI%20is%20enforced%20on%20the%20frontend%E2%80%94the%20%22Test%22%20button%20is%20disabled%20if%20your%20input%20exceeds%20200%20characters.%20The%20backend%20allows%20queries%20up%20to%20250%20characters%20and%20will%20reject%20anything%20longer%20with%20a%20validation%20error.%20The%20database%20itself%20does%20not%20impose%20a%20character%20limit%2C%20as%20it%20uses%20a%20LongText%20column%20for%20storing%20queries%2C%20so%20there%E2%80%99s%20no%20risk%20of%20truncation%20or%20errors%20at%20that%20layer.%0A%0AIf%20you%20want%20to%20increase%20or%20remove%20the%20frontend%20limit%2C%20update%20the%20logic%20in%20the%20React%20component%20at%20%60web/app/components/datasets/hit-testing/components/query-input/index.tsx%60%E2%80%94specifically%2C%20change%20the%20condition%20that%20disables%20the%20button%20when%20%60text.length%20%3E%20200%60%20%28%5Bsource%5D%28https%3A//github.com/langgenius/dify/blob/063b39ada56e0ad1a89559d3466fa82fd372cc6c/web/app/components/datasets/hit-testing/components/query-input/index.tsx%23L108-L201%29%29.%20%0A%0ATo%20adjust%20the%20backend%20limit%2C%20modify%20the%20%60hit_testing_args_check%60%20method%20in%20%60api/services/hit_testing_service.py%60%2C%20which%20currently%20enforces%20a%20250-character%20maximum%20%28%5Bsource%5D%28https%3A//github.com/langgenius/dify/blob/063b39ada56e0ad1a89559d3466fa82fd372cc6c/api/services/hit_testing_service.py%23L28-L189%29%29.%20%0A%0ANo%20changes%20are%20needed%20to%20the%20database%20schema%20for%20longer%20queries%20%28%5Bsource%5D%28https%3A//github.com/langgenius/dify/blob/063b39ada56e0ad1a89559d3466fa82fd372cc6c/api/models/dataset.py%23L983-L1095%29%29.%20For%20best%20results%2C%20keep%20the%20frontend%20and%20backend%20limits%20in%20sync%20to%20avoid%20confusing%20users.)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/29518)
Author
Owner

@laipz8200 commented on GitHub (Dec 11, 2025):

Hi @JohnJyong, Can you explain why there is this limitation here? If it is necessary, we need to add such a limitation in the API as well.

@laipz8200 commented on GitHub (Dec 11, 2025): Hi @JohnJyong, Can you explain why there is this limitation here? If it is necessary, we need to add such a limitation in the API as well.
Author
Owner

@dosubot[bot] commented on GitHub (Jan 12, 2026):

Hi, @DavideDelbianco. I'm Dosu, and I'm helping the Dify team manage their backlog and am marking this issue as stale.

Issue Summary:

  • You reported a character limit on knowledge query text in Dify v1.11.0 (Docker), suspecting a 200-character database constraint.
  • It was clarified that the 200-character limit is a frontend UI restriction; the backend allows up to 250 characters.
  • The database uses a LongText column without limits, so no schema changes are needed.
  • I provided guidance on how to modify the React frontend and backend validation to change these limits.
  • Another user asked about the necessity of this limit and syncing API limits if required.

Next Steps:

  • Please let me know if this character limit issue is still relevant with the latest version of Dify by commenting here.
  • Otherwise, this issue will be automatically closed in 15 days.

Thanks for your understanding and contribution!

@dosubot[bot] commented on GitHub (Jan 12, 2026): Hi, @DavideDelbianco. I'm [Dosu](https://dosu.dev), and I'm helping the Dify team manage their backlog and am marking this issue as stale. **Issue Summary:** - You reported a character limit on knowledge query text in Dify v1.11.0 (Docker), suspecting a 200-character database constraint. - It was clarified that the 200-character limit is a frontend UI restriction; the backend allows up to 250 characters. - The database uses a LongText column without limits, so no schema changes are needed. - I provided guidance on how to modify the React frontend and backend validation to change these limits. - Another user asked about the necessity of this limit and syncing API limits if required. **Next Steps:** - Please let me know if this character limit issue is still relevant with the latest version of Dify by commenting here. - Otherwise, this issue will be automatically closed in 15 days. Thanks for your understanding and contribution!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#20978