Replay should continue unfinished work without repeating completed effects. Preserve the original event identity, record the recovery attempt separately and check which steps already succeeded.
Establish where the first run stopped
Inspect the recorded stage, error and side effects under authorised access. A worker can fail after completing an external action but before storing its completion marker. In that case, repeating the entire function may repeat an action that already happened. Resolve the uncertainty using the downstream system’s supported reference or status query.
A dead-letter queue is one way to isolate work that was not successfully processed. Amazon SQS documents this pattern and supports redrive procedures. The presence of such a queue does not itself establish that a particular event is safe to replay; that remains an application-level decision.

| Record | Purpose |
|---|---|
| Original event identity | Preserve the logical source event |
| Completed steps | Show which effects must not be repeated |
| Replay attempt | Identify this recovery operation and its operator |
| Outcome | Record completion or the next explicit failure state |
Do not create a fresh logical message identifier merely to avoid duplicate detection. That can remove the guard intended to prevent repeated work. A replay attempt can have its own tracking reference while retaining the original event and business action identity.
Fix the cause before restarting a batch
A missing configuration, invalid resource mapping or rejected downstream request may fail again unchanged. Test the correction with a small controlled scope. Identify the exact events and intended steps rather than replaying an entire queue because several entries show the same error text.
If the system offers a dry-run or inspection mode, establish what it actually does before using it on a backlog. A mode called preview should not call external services, change records or advance completion markers unless those effects are explicitly intended. Compare the proposed event set with the authorised selection, then require a deliberate transition from inspection to execution. Do not assume an option name guarantees that nothing will happen.
Delayed work can also be stale. Check whether the original task is still appropriate and whether the current account is authorised for the action. A message that was relevant yesterday does not automatically justify a notification or account change today.

Keep the recovery operation auditable and bounded
Record who initiated the replay, why, which event set was selected and what result was observed. Apply normal access controls to bodies and credentials. A broad export of private messages is not needed merely to approve a processing retry.
In an isolated test, include a completely unprocessed event, a partly completed event and an already completed event. The recovery path should continue the first, handle the second according to stored evidence and avoid repeating the third. These fixtures establish behaviour without manufacturing a real incident history.
If a retry fails again, retain a clear failure state and stop unbounded loops. An operator should be able to tell that the event remains unresolved rather than seeing a success counter increase each time work was merely queued. For workflows where ordering matters, also review whether moving events aside and replaying them changes the business sequence; a queue feature cannot decide that policy for you.
Technical reference: Amazon SQS: dead-letter queues.
