API losing message #6010

Closed
opened 2026-02-21 18:13:40 -05:00 by yindo · 6 comments
Owner

Originally created by @ip2cloud on GitHub (Oct 10, 2024).

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

From 0.9.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Until version 0.8.3, communication via the API works without losing messages.

As of 0.9.0, messages are being lost despite the counter confirming that the number of messages is growing.

The attached image shows:

message counter: 4

but only the last one is registered.

This is causing the flow to restart the conversation every time because there is no memory of the conversation.

This is preventing the use of the API via the WEB only

Captura de Tela 2024-10-10 às 12 47 25

✔️ Expected Behavior

Save the previous message to have the flow memory

Actual Behavior

Only the last message remains in memory, this is causing the flow to restart

Originally created by @ip2cloud on GitHub (Oct 10, 2024). ### 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 From 0.9.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce Until version 0.8.3, communication via the API works without losing messages. As of 0.9.0, messages are being lost despite the counter confirming that the number of messages is growing. The attached image shows: message counter: 4 but only the last one is registered. This is causing the flow to restart the conversation every time because there is no memory of the conversation. This is preventing the use of the API via the WEB only ![Captura de Tela 2024-10-10 às 12 47 25](https://github.com/user-attachments/assets/ebe68da4-3851-4ecd-9167-ddc9e6c25639) ### ✔️ Expected Behavior Save the previous message to have the flow memory ### ❌ Actual Behavior Only the last message remains in memory, this is causing the flow to restart
yindo added the 🐞 bug label 2026-02-21 18:13:40 -05:00
yindo closed this issue 2026-02-21 18:13:40 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Oct 10, 2024):

I found a similar discussion regarding issues with messages and conversation memory in Dify. You might find it helpful to check out this discussion where a user reported that their agent does not have memory [1].

In version 0.9.0, there was a change in how messages are handled. Messages with a parent_message_id of NULL invoked from service-api are updated to have a parent_message_id of UUID_NIL. This might be affecting your message handling [2].

If your issue persists, you might want to verify if this change is related to the problem you're experiencing.

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Oct 10, 2024): <!-- Answer --> I found a similar discussion regarding issues with messages and conversation memory in Dify. You might find it helpful to check out this [discussion](https://github.com/langgenius/dify/discussions/8974) where a user reported that their agent does not have memory <sup>[[1]](https://github.com/langgenius/dify/discussions/8974)</sup>. In version 0.9.0, there was a change in how messages are handled. Messages with a `parent_message_id` of `NULL` invoked from `service-api` are updated to have a `parent_message_id` of `UUID_NIL`. This might be affecting your message handling <sup>[[2]](https://github.com/langgenius/dify/blob/main/api/migrations/versions/2024_10_09_1329-d8e744d88ed6_fix_wrong_service_api_history.py)</sup>. If your issue persists, you might want to verify if this change is related to the problem you're experiencing. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@ip2cloud commented on GitHub (Oct 10, 2024):

in fact the problem is https://github.com/langgenius/dify/discussions/8974 the same but I saw that there was no solution. I am sending the queries as requested by the API. I need help with this bug.

@ip2cloud commented on GitHub (Oct 10, 2024): in fact the problem is https://github.com/langgenius/dify/discussions/8974 the same but I saw that there was no solution. I am sending the queries as requested by the API. I need help with this bug.
Author
Owner

@dosubot[bot] commented on GitHub (Oct 10, 2024):

The issue you're experiencing with message loss and conversation memory in Dify version 0.9.0 and 0.9.1 might be related to changes in how messages are handled, specifically with the parent_message_id being updated to UUID_NIL. This change could affect how messages are retained and linked in the conversation flow.

To address this, you might want to:

  1. Check the Migration Scripts: Ensure that your database schema is up-to-date with the latest migration scripts, as these include changes related to message handling [1].

  2. Verify API Calls: Double-check that your API calls include the correct conversation_id and parent_message_id to maintain the conversation context.

  3. Review Code Changes: Look into any recent code changes or updates in the repository that might affect message handling.

If these steps don't resolve the issue, consider testing with a previous version to see if the problem persists, which could help identify if the issue is version-specific.

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Oct 10, 2024): <!-- Answer --> The issue you're experiencing with message loss and conversation memory in Dify version 0.9.0 and 0.9.1 might be related to changes in how messages are handled, specifically with the `parent_message_id` being updated to `UUID_NIL`. This change could affect how messages are retained and linked in the conversation flow. To address this, you might want to: 1. **Check the Migration Scripts:** Ensure that your database schema is up-to-date with the latest migration scripts, as these include changes related to message handling <sup>[[1]](https://github.com/langgenius/dify/blob/main/api/migrations/versions/64b051264f32_init.py)</sup>. 2. **Verify API Calls:** Double-check that your API calls include the correct `conversation_id` and `parent_message_id` to maintain the conversation context. 3. **Review Code Changes:** Look into any recent code changes or updates in the repository that might affect message handling. If these steps don't resolve the issue, consider testing with a previous version to see if the problem persists, which could help identify if the issue is version-specific. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@ip2cloud commented on GitHub (Oct 10, 2024):

As I said before... in the previous version (0.8.3) it is working normally. As of 0.9.0 (0.9.1, 0.10.0-beta1 and 0.10.0-beta2) it is not working. I need help from a human.

@ip2cloud commented on GitHub (Oct 10, 2024): As I said before... in the previous version (0.8.3) it is working normally. As of 0.9.0 (0.9.1, 0.10.0-beta1 and 0.10.0-beta2) it is not working. I need help from a human.
Author
Owner

@crazywoola commented on GitHub (Oct 10, 2024):

Duplicated, we haven’t released the new version yet together with the fix.

@crazywoola commented on GitHub (Oct 10, 2024): Duplicated, we haven’t released the new version yet together with the fix.
Author
Owner

@ip2cloud commented on GitHub (Oct 10, 2024):

Thank you... just to help anyone who arrives here, the version is release-0.9.2. I already tested it and it is resolved

@ip2cloud commented on GitHub (Oct 10, 2024): Thank you... just to help anyone who arrives here, the version is release-0.9.2. I already tested it and it is resolved
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#6010