Error When Creating Knowledge: "rules" Error Prevents Chunk Preview #6514

Closed
opened 2026-02-21 18:16:05 -05:00 by yindo · 3 comments
Owner

Originally created by @MitraSafarinejad on GitHub (Nov 2, 2024).

Originally assigned to: @JohnJyong on GitHub.

Self Checks

  • 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 (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.10.2

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

I am encountering an issue with Dify version 0.10.2 when attempting to create Knowledge. After uploading a file, I receive an error message indicating a "rules" error. Despite the error, the file upload completes successfully. However, the chunk preview does not display as expected. Here are the details of the error:

image

Error Message:
[{"code": "indexing_estimate_error", "message": "'rules'", "status": 500}]

The relevant logs are:

Traceback (most recent call last):
api-1         |   File "/app/api/.venv/lib/python3.10/site-packages/flask/app.py", line 880, in full_dispatch_request
api-1         |     rv = self.dispatch_request()
api-1         |   File "/app/api/.venv/lib/python3.10/site-packages/flask/app.py", line 865, in dispatch_request
api-1         |     return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
api-1         |   File "/app/api/.venv/lib/python3.10/site-packages/flask_restful/__init__.py", line 489, in wrapper
api-1         |     resp = resource(*args, **kwargs)
api-1         |   File "/app/api/.venv/lib/python3.10/site-packages/flask/views.py", line 110, in view
api-1         |     return current_app.ensure_sync(self.dispatch_request)(**kwargs)  # type: ignore[no-any-return]
api-1         |   File "/app/api/.venv/lib/python3.10/site-packages/flask_restful/__init__.py", line 604, in dispatch_request
api-1         |     resp = meth(*args, **kwargs)
api-1         |   File "/app/api/controllers/console/wraps.py", line 142, in decorated
api-1         |     return view(*args, **kwargs)
api-1         |   File "/app/api/libs/login.py", line 92, in decorated_view
api-1         |     return current_app.ensure_sync(func)(*args, **kwargs)
api-1         |   File "/app/api/controllers/console/wraps.py", line 26, in decorated
api-1         |     return view(*args, **kwargs)
api-1         |   File "/app/api/controllers/console/datasets/datasets.py", line 464, in post
api-1         |     raise IndexingEstimateError(str(e))
api-1         | controllers.console.datasets.error.IndexingEstimateError: 500 Internal Server Error: 'rules'

✔️ Expected Behavior

After uploading a file, the system should successfully complete the process and display the chunk preview without any errors.

Actual Behavior

While the file is uploaded successfully, an error message related to "rules" appears, and the chunk preview is not displayed as it should be

Originally created by @MitraSafarinejad on GitHub (Nov 2, 2024). Originally assigned to: @JohnJyong on GitHub. ### Self Checks - [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 (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.10.2 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce I am encountering an issue with Dify version 0.10.2 when attempting to create Knowledge. After uploading a file, I receive an error message indicating a "rules" error. Despite the error, the file upload completes successfully. However, the chunk preview does not display as expected. Here are the details of the error: ![image](https://github.com/user-attachments/assets/fc4229f5-d09b-4eb9-8c44-852903585ff1) Error Message: `[{"code": "indexing_estimate_error", "message": "'rules'", "status": 500}]` The relevant logs are: ``` Traceback (most recent call last): api-1 | File "/app/api/.venv/lib/python3.10/site-packages/flask/app.py", line 880, in full_dispatch_request api-1 | rv = self.dispatch_request() api-1 | File "/app/api/.venv/lib/python3.10/site-packages/flask/app.py", line 865, in dispatch_request api-1 | return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return] api-1 | File "/app/api/.venv/lib/python3.10/site-packages/flask_restful/__init__.py", line 489, in wrapper api-1 | resp = resource(*args, **kwargs) api-1 | File "/app/api/.venv/lib/python3.10/site-packages/flask/views.py", line 110, in view api-1 | return current_app.ensure_sync(self.dispatch_request)(**kwargs) # type: ignore[no-any-return] api-1 | File "/app/api/.venv/lib/python3.10/site-packages/flask_restful/__init__.py", line 604, in dispatch_request api-1 | resp = meth(*args, **kwargs) api-1 | File "/app/api/controllers/console/wraps.py", line 142, in decorated api-1 | return view(*args, **kwargs) api-1 | File "/app/api/libs/login.py", line 92, in decorated_view api-1 | return current_app.ensure_sync(func)(*args, **kwargs) api-1 | File "/app/api/controllers/console/wraps.py", line 26, in decorated api-1 | return view(*args, **kwargs) api-1 | File "/app/api/controllers/console/datasets/datasets.py", line 464, in post api-1 | raise IndexingEstimateError(str(e)) api-1 | controllers.console.datasets.error.IndexingEstimateError: 500 Internal Server Error: 'rules' ``` ### ✔️ Expected Behavior After uploading a file, the system should successfully complete the process and display the chunk preview without any errors. ### ❌ Actual Behavior While the file is uploaded successfully, an error message related to "rules" appears, and the chunk preview is not displayed as it should be
yindo added the 🐞 bug label 2026-02-21 18:16:05 -05:00
yindo closed this issue 2026-02-21 18:16:05 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Nov 2, 2024):

The error you're encountering seems to be related to the handling of the rules variable during the knowledge creation process in Dify. The error message IndexingEstimateError with the message 'rules' suggests that there might be an issue with how the rules are being retrieved or applied during the indexing process.

Here are a few things to consider:

  1. Check the get_process_rules Method: The rules variable is defined in the get_process_rules method of the DatasetService class. This method retrieves the latest processing rules for a given dataset. If no specific rules are found, it defaults to the rules defined in DocumentService.DEFAULT_RULES [1].

  2. Ensure Default Rules are Defined: Make sure that the default rules in DocumentService are correctly defined and accessible. The default rules should include pre-processing rules and segmentation settings.

  3. Review the post Method in datasets.py: The post method in datasets.py is responsible for handling the indexing process. The error handling block for IndexingEstimateError suggests that the error might be occurring during the execution of the indexing_runner.indexing_estimate method [2].

  4. Dependencies in Chunk Preview: The rules variable is used in the chunk preview functionality to manage pre-processing rules. Ensure that the functions setRules, getRules, getRulesFromDetail, and resetRules are correctly implemented and that they properly update the rules state [3].

By checking these areas, you might be able to identify where the issue with the rules variable is occurring and resolve the error preventing the chunk preview from displaying.

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Nov 2, 2024): <!-- Answer --> The error you're encountering seems to be related to the handling of the `rules` variable during the knowledge creation process in Dify. The error message `IndexingEstimateError` with the message `'rules'` suggests that there might be an issue with how the `rules` are being retrieved or applied during the indexing process. Here are a few things to consider: 1. **Check the `get_process_rules` Method**: The `rules` variable is defined in the `get_process_rules` method of the `DatasetService` class. This method retrieves the latest processing rules for a given dataset. If no specific rules are found, it defaults to the rules defined in `DocumentService.DEFAULT_RULES` <sup>[[1]](https://github.com/langgenius/dify/blob/main/api/services/dataset_service.py)</sup>. 2. **Ensure Default Rules are Defined**: Make sure that the default rules in `DocumentService` are correctly defined and accessible. The default rules should include pre-processing rules and segmentation settings. 3. **Review the `post` Method in `datasets.py`**: The `post` method in `datasets.py` is responsible for handling the indexing process. The error handling block for `IndexingEstimateError` suggests that the error might be occurring during the execution of the `indexing_runner.indexing_estimate` method <sup>[[2]](https://github.com/langgenius/dify/blob/main/api/controllers/console/datasets/datasets.py)</sup>. 4. **Dependencies in Chunk Preview**: The `rules` variable is used in the chunk preview functionality to manage pre-processing rules. Ensure that the functions `setRules`, `getRules`, `getRulesFromDetail`, and `resetRules` are correctly implemented and that they properly update the `rules` state <sup>[[3]](https://github.com/langgenius/dify/blob/main/web/app/components/datasets/create/step-two/index.tsx)</sup>. By checking these areas, you might be able to identify where the issue with the `rules` variable is occurring and resolve the error preventing the chunk preview from displaying. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@soulzzz commented on GitHub (Nov 6, 2024):

i got the same issue happened

@soulzzz commented on GitHub (Nov 6, 2024): i got the same issue happened
Author
Owner

@JohnJyong commented on GitHub (Nov 8, 2024):

fixed by #10258

@JohnJyong commented on GitHub (Nov 8, 2024): fixed by #10258
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#6514