Failed to modify segment #900

Closed
opened 2026-02-21 17:28:56 -05:00 by yindo · 3 comments
Owner

Originally created by @wangrg on GitHub (Jan 13, 2024).

Self Checks

Dify version

0.3.34

Cloud or Self Hosted

Self Hosted (Docker), Self Hosted (Source)

Steps to reproduce

When I edit the segment content and submit it, the status of the segment becomes disabled.
image

error log:
image

✔️ Expected Behavior

Modification of segment content successful

Actual Behavior

Incorrect segment modification

Originally created by @wangrg on GitHub (Jan 13, 2024). ### Self Checks - [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 file this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). ### Dify version 0.3.34 ### Cloud or Self Hosted Self Hosted (Docker), Self Hosted (Source) ### Steps to reproduce When I edit the segment content and submit it, the status of the segment becomes disabled. <img width="393" alt="image" src="https://github.com/langgenius/dify/assets/1925650/ba21f647-166e-4f3e-8ca3-a94731103852"> error log: <img width="383" alt="image" src="https://github.com/langgenius/dify/assets/1925650/2c917de1-8db3-4d9a-8f45-2cdf128476cc"> ### ✔️ Expected Behavior Modification of segment content successful ### ❌ Actual Behavior Incorrect segment modification
yindo added the 🐞 bug label 2026-02-21 17:28:56 -05:00
yindo closed this issue 2026-02-21 17:28:56 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jan 13, 2024):

🤖

Hello @wangrg! 👋

I'm Dosu, an AI here to assist while we wait for a human maintainer. I'm here to help troubleshoot bugs, answer questions, and assist you in becoming a contributor. Be assured, we'll get your issue sorted out together. 😊

The issue you're experiencing with the segment status becoming disabled when you attempt to edit its content in Dify version 0.3.34 is due to the way the system handles indexing. When a segment is being edited, the system checks if the segment is currently being indexed. If it is, the system raises an InvalidActionError and prevents the edit from taking place. This is done to ensure data consistency and prevent potential issues that could arise from modifying a segment while it's being indexed.

Here is the relevant code snippet from the api/controllers/console/datasets/datasets_segments.py file:

document_indexing_cache_key = 'document_{}_indexing'.format(segment.document_id)
cache_result = redis_client.get(document_indexing_cache_key)
if cache_result is not None:
    raise InvalidActionError("Document is being indexed, please try again later")

indexing_cache_key = 'segment_{}_indexing'.format(segment.id)
cache_result = redis_client.get(indexing_cache_key)
if cache_result is not None:
    raise InvalidActionError("Segment is being indexed, please try again later")

In this code, redis_client.get(document_indexing_cache_key) and redis_client.get(indexing_cache_key) are used to check if the document or the segment is currently being indexed. If either is being indexed (i.e., if cache_result is not None), an InvalidActionError is raised, and the status of the segment is set to disabled.

As for the changes made to the segment editing functionality between Dify version 0.3.34 and the latest version v0.4.6, I wasn't able to find specific information within the repository. It's possible that changes were made elsewhere or I may have missed them. If you could provide more details about the specific functionality or changes you're interested in, I might be able to provide a more accurate answer.

Sources


This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

@dosubot[bot] commented on GitHub (Jan 13, 2024): _🤖_ <!-- Greeting --> Hello @wangrg! 👋 I'm [Dosu](https://dosu.dev), an AI here to assist while we wait for a human maintainer. I'm here to help troubleshoot bugs, answer questions, and assist you in becoming a contributor. Be assured, we'll get your issue sorted out together. 😊 <!-- Answer --> The issue you're experiencing with the segment status becoming disabled when you attempt to edit its content in Dify version 0.3.34 is due to the way the system handles indexing. When a segment is being edited, the system checks if the segment is currently being indexed. If it is, the system raises an `InvalidActionError` and prevents the edit from taking place. This is done to ensure data consistency and prevent potential issues that could arise from modifying a segment while it's being indexed. Here is the relevant code snippet from the [api/controllers/console/datasets/datasets_segments.py](https://github.com/langgenius/dify/blob/main/api/controllers/console/datasets/datasets_segments.py) file: ```py document_indexing_cache_key = 'document_{}_indexing'.format(segment.document_id) cache_result = redis_client.get(document_indexing_cache_key) if cache_result is not None: raise InvalidActionError("Document is being indexed, please try again later") indexing_cache_key = 'segment_{}_indexing'.format(segment.id) cache_result = redis_client.get(indexing_cache_key) if cache_result is not None: raise InvalidActionError("Segment is being indexed, please try again later") ``` In this code, `redis_client.get(document_indexing_cache_key)` and `redis_client.get(indexing_cache_key)` are used to check if the document or the segment is currently being indexed. If either is being indexed (i.e., if `cache_result` is not `None`), an `InvalidActionError` is raised, and the status of the segment is set to disabled. As for the changes made to the segment editing functionality between Dify version 0.3.34 and the latest version v0.4.6, I wasn't able to find specific information within the repository. It's possible that changes were made elsewhere or I may have missed them. If you could provide more details about the specific functionality or changes you're interested in, I might be able to provide a more accurate answer. ## Sources - [api/controllers/console/datasets/datasets_segments.py](https://github.com/langgenius/dify/blob/main/api/controllers/console/datasets/datasets_segments.py) --- This response is meant to be useful and save you time. It is **not meant to be a precise solution**, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot.
Author
Owner

@crazywoola commented on GitHub (Jan 14, 2024):

I think you should upgrade to latest version. Since this version is quite outdated.

@crazywoola commented on GitHub (Jan 14, 2024): I think you should upgrade to latest version. Since this version is quite outdated.
Author
Owner

@wangrg commented on GitHub (Jan 14, 2024):

There are some missing modifications in the latest version.
截屏2024-01-15 09 43 30

@wangrg commented on GitHub (Jan 14, 2024): There are some missing modifications in the latest version. <img width="427" alt="截屏2024-01-15 09 43 30" src="https://github.com/langgenius/dify/assets/1925650/00358db4-94c5-444d-804f-ef92d9ac1d44">
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#900