This topic describes the "message not exist" error message that appears when you delete a message in Message Service (MNS). This topic also describes the cause and solution to the issue.

Issue

The following error message appears when you delete a message in MNS:
message not exist

Cause

This issue occurs because the receipt handle of the message becomes invalid when the visibility timeout period ends. The following information describes how the issue occurs:

  • When a consumer receives the message, the status of the message changes from active to inactive.
  • The visibility timeout period takes effect for the inactive message. During the visibility timeout period, you can delete the message.
  • After the visibility timeout period ends, the status of the message changes from inactive to active. Then, other consumers can consume the message and the receipt handle of the message becomes invalid.
  • If an invalid receipt handle is used to delete the message, the system returns the "message not exist" error message.

Solution

Set the VisibilityTimeout parameter to an appropriate value, and delete the message the next time the message is received. When you change the value of the VisibilityTimeout parameter, take note of the following items:

  • This issue may occur if you set the VisibilityTimeout parameter to a small value and cannot delete a message within the specified visibility timeout period.
  • If you set the VisibilityTimeout parameter to a large value, you cannot re-process the message within a short period of time after you fail to process the message.