Success Behind an Error Message — Designing to Prevent Duplicate Execution

A lost response does not mean the operation failed. A deadline change shows how to design request identification, duplicate prevention, external notifications, retries, and recovery.
← All posts
온
온틀 리서치
2026년 11월 11일 Updated 2026.11.24 54 min read views 8

The save succeeded, but the screen says it failed

A customer changes a project deadline. They click Save and wait, but an error appears. They click again. This time, they see a success message.

Meanwhile, the person responsible receives two change notifications. The schedule history has two entries. If the system also created a review task automatically, there are now two copies of the same task. The assignee asks which one to handle, and the customer says they only made one request.

Temporarily disabling the button is an easy first fix to reach for. It helps reduce repeated clicks. But it tells us nothing about how far the first request got.

The server may have finished saving even though the response never reached the customer. The connection may have dropped, or the screen may have stopped waiting. Not receiving a response and an operation failing are different things.

This gap is where operations get difficult. If you know something failed, you can fix it and run it again. If you do not know whether it succeeded, running it again can itself cause an incident.

For this article, imagine a service like ONTLE, where an AI project manager turns customer requests into work. We will follow a customer changing a deadline, the approved change being applied to the schedule, and the person responsible being notified. This is not an account of ONTLE’s actual internal implementation or an incident it experienced. All dates and identifiers used here are fictional examples.

First, define one unit of work

Before choosing the technology, decide what must not happen twice.

Consider a request to move a deadline from the 18th to the 21st. If you only look at receiving the same request again and saving the date as the 21st, there seems to be little problem. The final date is the same.

But what if every save adds a change history entry? What if it also creates a review task and notifies the assignee? Checking the date alone will not reveal duplicate processing.

In this example, we can define one unit of work as follows.

  • Create one schedule change history entry for each approved change request.
  • Create one review task of each required type arising from that change.
  • Track delivery of the assignee notification separately.

There is a reason notifications get their own entry. Confirming success for records inside the service and messages sent outside it is difficult to do in the same way. If we treat saving the date and delivering the notification as a single operation, it becomes harder to decide which part to retry later.

Idempotency is the property of an operation that produces the same effect whether it is requested once or multiple times. In this article, we use the term as a basis for reasoning about duplicate execution.

But declaring “this feature is idempotent” is not enough. You need to state the scope: does only the date stay the same, or do the history and follow-up tasks remain unchanged too? When writing success criteria in a feature specification, I recommend also listing the records that must not multiply after repeated requests.

Identical content does not mean identical intent

The simplest way to find duplicates is to compare request content. If the project and the target date match, treat them as the same request.

The problem is that a customer may request the same thing again later. They might change a deadline, restore the original date, and then choose that same new date again. Even if the wording matches the earlier request, this is a new decision.

Conversely, the same decision can arrive through different channels. A customer might submit a change through a form, then ask in chat, “Has the request I just submitted been processed?” If the AI interprets that status question as a new instruction to make the change, the work is duplicated even though the wording differs.

That is why request content and request identity must be separate.

A request identifier is a unique ID assigned to a single intent. Suppose we give a change request the ID C-104. If a connection problem forces us to send it again, we keep that ID. If the customer revises the details and submits a new change, we issue a different ID.

We do not create an ID for every transmission attempt. We create it when the initial submission intent is settled, then retain it until we can confirm the outcome. If customers need to find pending requests after reopening the screen, the server needs to keep a record of submissions.

If different content arrives under the same ID, do not silently overwrite the original. That would change the meaning of a request already entrusted to the service. The server should report that the request does not match the existing one. Having callers supply an identifier for their intent and preserve it across retries is also covered in AWS’s guide to designing idempotent APIs. An API is a contract through which programs exchange requests and results.

The ID itself does not grant access. Knowing another organization’s request ID must not let someone retrieve its result. Check the current user’s permissions both when processing a new request and when returning a previous result.

Distinguish AI proposals from approved changes

Let us return to the deadline change. The customer says, “The acceptance review has slipped, so please push the deadline back by three days.” The AI project manager identifies the affected tasks and proposes a change.

Using the natural-language sentence itself as the basis for execution makes this fragile. Rereading the same conversation can produce different wording or interpretations. Depending on when execution happens, even the date from which to count “three days” may become ambiguous.

It is better to record concrete values for approval: the project, its existing deadline, the new deadline, and the follow-up tasks to create. The customer or an authorized person reviews and approves that proposal.

Assign the approved change a separate operation ID. A request ID identifies a submission from a screen; an operation ID identifies the decision that was actually approved. These serve different purposes. Requests arriving through multiple channels can all be linked to the execution of one approved change.

This distinction is especially useful during retries. Even if the AI regenerates its explanation, the dates and targets for execution come from the approved record. It does not reinterpret an already approved decision to produce new execution details.

This does not mean adding human approval to every change. If the service permits certain changes to be handled automatically, follow those rules. What matters is that a record can identify exactly what was settled before execution.

When a customer asks about the result, look up this record first. If execution is still in progress, explain its status. If it is unclear whether the customer is making a new request unrelated to the existing proposal, confirm their intent before changing the date again.

Checking “has this been processed?” is not enough

Now suppose the server receives the same change request twice. Both requests look up the processing record. There is no record yet. Both may conclude that they are first.

There is a gap between reading and writing. However short it is, another request can slip in. This is a race condition: the outcome depends on the order in which concurrent operations run.

It is safer to give the database, which stores the data durably, the final say on duplicate prevention. A database unique constraint is a rule that prevents duplicate values, or combinations of values, from being stored. PostgreSQL provides unique constraints across multiple columns and a way to skip an insert when a conflict occurs. The behavior is described in its constraints documentation and INSERT documentation.

In this example, we could identify duplicates using the combination of organization, operation type, and request ID. Every field must have a value. An exception that says “just proceed if there is no ID” leaves the most important path without duplicate protection.

If the same request already exists, read its result. But do not return that result just because the ID matches. Verify that the values defining the operation—such as the project, target deadline, and approved change—match the existing content.

Content comparison needs rules too. A different date format or trailing whitespace should not turn a request into a different operation. Conversely, a matching date should not make two operations equivalent when the assignee or target project has changed. Specify how execution values will be normalized before comparison.

We also need to prevent the same approved change from being executed twice under different request IDs. One way is to add a unique constraint to the schedule change history based on the approved change ID. This blocks duplicate requests at the entry point and duplicate work at the business level.

Saving the processing record first and changing the schedule later creates another problem. If the server stops between the two, the request is marked as processed even though the schedule is unchanged.

Reversing the order does not solve it. If the date changes but the server stops before saving the processing record, a retried request may apply the same change again.

A transaction groups multiple data changes so that either all are applied or all are rolled back. For a deadline change that stays within one database, consider putting these records in a single transaction.

  1. Register the request ID and execution details.
  2. Check that the approved change has not already been applied.
  3. Update the project deadline.
  4. Create the change history entry and any required internal tasks.
  5. Record the notification to be sent later.
  6. Save the request’s completion result.

If any step fails, roll back the whole transaction. If everything was saved and only the response was lost, a retry can return the stored completion result.

This approach suits short internal operations. Avoid holding a transaction open while waiting for an AI call to analyze a document or for an external service to respond. Other requests may be left waiting a long time to modify the same data.

Perform lengthy preparation before execution, then keep the actual update short. Just before applying it, check whether circumstances changed during preparation. Whether an old proposal is still valid is a separate question from whether it is a duplicate.

What happens when different changes arrive at the same time?

Suppose the assignee updates the deadline while the customer’s proposal is being prepared. The screen the customer reviewed and approved is no longer current.

The two requests have different IDs. Duplicate prevention will recognize both as legitimate requests. That does not mean the later change should automatically overwrite the earlier one.

This is where a version comes in. A version is a number that increases whenever the data changes. If the project was at version 7 when the customer reviewed the proposal, include that value in the execution request. The server updates the project and increments its version only if it is still at version 7.

If another update has already changed the version, stop. Show the customer the latest schedule and what changed so they can reconsider. This is called optimistic locking. Instead of holding data locked for a long time, it checks for intervening changes just before saving.

More important than the name is preserving the user’s decision. The customer approved a change to the schedule they saw. They did not approve overwriting changes they had never seen.

Some services may be able to merge changes automatically. If only descriptive text changed and it does not affect the deadline calculation, applying the proposal may still be valid. But there must be business rules defining which changes can be disregarded. Simply replacing the version with the latest one and retrying to reduce errors defeats the purpose of the check.

When explaining a version conflict, do not show only “Save failed.” Showing the latest value alongside the value the user wanted to apply makes it easier to decide what to do next.

Put a record between saving the schedule and sending the notification

Internal storage is now covered. Next, we need to notify the assignee.

If the server stops immediately after saving the date, the notification may be missed. If it sends the notification first, the deadline change announcement may go out even though saving the date fails. Running two lines of code in sequence does not make two systems succeed together.

The outbox pattern addresses this gap. An outbox records messages in the database before they are sent. A separate worker handles the actual transmission. The principle of saving a schedule change and its outgoing message in the same transaction is described in AWS’s transactional outbox documentation.

With this design, a saved deadline means there is also a record of the message to send. Even if the sending worker stops temporarily, it can find pending items again. That record alone does not guarantee delivery, however. An operational process must keep attempting to send it.

You also need to decide what the notification contains. Recording the date at the time of the change and the change history ID makes it clear which decision the notification concerns, even if it is sent later. Reading only the latest deadline at send time can make the message reflect a different change from the one that triggered it.

Recipients need a policy too. Sending to the assignee at the time of the change and sending to the assignee at send time can produce different results. With the former, you need to recheck access to avoid sending sensitive information to someone who has since lost permission. With the latter, you can notify the person currently responsible after a reassignment, but that may differ from the originally intended recipient.

I recommend treating these as more than implementation choices. Who needs to know about which change is a business rule.

For external sends, “unknown” is a valid state

Even with an outbox, one final gap remains. The external notification service may accept the message, but the connection may drop before we receive its response. Our service has no record that sending completed.

Sending the item again may deliver the same notification twice. If the external service supports deduplicating repeated requests with the same transmission ID, we can use that capability. But we need to check the ID’s scope, its retention period, and what happens if different content is sent under the same ID. Do not assume every service offers the same contract.

Without that capability, there is a tradeoff. Resending to reduce omissions means accepting the possibility of duplicates. Stopping to avoid duplicates leaves open the possibility that nothing was delivered.

That is why it is better to have more than two states, success and failure. At a minimum, the system should represent these distinctions.

State What we know Next action
Pending No send has been attempted yet A worker picks up the item
Sending A specific worker has claimed the item Wait for a result for a defined period
External acceptance confirmed The external service responded that it accepted the message Track subsequent delivery results if available
Outcome needs verification A send was attempted, but acceptance is unknown Check external records or refer it to an operator

Acceptance and delivery must also be distinguished. The fact that an external service received a request does not mean the assignee has read the message.

The customer’s screen can show only what is confirmed: “Deadline updated; checking assignee notification.” If the date has already changed but the screen reports a total failure, the customer may start the change request again. Interface wording is part of preventing duplicate execution.

Retries need a stopping point and an owner

When adding automatic retries, decide what to retry before deciding how often.

Sending the same request again will not fix missing permissions or an invalid date format. A temporary connection failure may benefit from a retry. A request whose outcome is unknown because the response was lost must follow the duplicate prevention and status lookup procedures established earlier.

It is also better to give retry ownership a clear home. If the screen, server, and worker each repeat requests independently, the actual number of attempts becomes difficult to track. Even when retries are needed at multiple stages, they should share the overall request deadline and attempt budget.

Retry intervals can increase gradually and include some variation. This reduces the chance that requests which failed together will all return at the same moment. But increasing the interval does not bring the work to a conclusion. There must be somewhere to send it after the final attempt.

For a deadline change notification, the system could retry automatically for a set period, then add it to an operations queue. That queue should include the failure reason, the time of the last attempt, and how to check the outcome next. An operator can verify external acceptance, then resend the message or close the item.

The system must also handle a worker disappearing while sending. Recording when work was assigned and how long the assignment remains valid helps identify stalled items. But an expired assignment does not prove the previous worker has stopped. A slow worker may still be running and send at the same time as its replacement.

Internal records can be protected by checking that only the current owner updates them. Preventing duplicate external sends still depends on the other service’s deduplication contract. For work where this limitation matters greatly, it is better to route an expired item for verification instead of automatically resending it merely because time has elapsed.

“Run again” in the operations console must follow the same rules

During development, teams sometimes carefully protect the customer request path while leaving a powerful rerun button in the operations console. When an incident happens, that button is often the first thing someone presses.

A retry that continues the original request must be distinguished from a rerun that creates new work. Issuing a new request ID when the goal is to check the outcome of an existing notification bypasses your own duplicate prevention records.

Operators must first be able to see which stages have finished. They need separate views of the deadline update, review task creation, and external notification status. Then they can resume only the stalled stage. A button that restarts the entire procedure makes that judgment harder.

It also helps to use different identifiers for different purposes. An operation ID tracks one customer decision. An attempt ID distinguishes each individual connection or execution attempt made to carry out that decision. Multiple attempts need to be grouped under one operation so the cause of a failure can be traced.

A total error count is not enough for monitoring either. The age of the oldest pending notification, the number of items awaiting outcome verification, and the frequency of different content arriving under the same request ID reveal different problems.

Do not automatically log entire request bodies. First define the identifiers, states, timestamps, and error categories needed for troubleshooting. Aim to make the processing path understandable without retaining customer messages or document contents.

What you can only verify by injecting failures

Sending one normal request and confirming success does not validate this design. You need to deliberately interrupt the flow at the points where things can go wrong.

First, create a situation where the internal save finishes but the response is not delivered. Send the same request again and check that the previous result is returned. Check the counts of change history entries and follow-up tasks, not just the schedule.

Next, send the same request concurrently. This is a different test from sending it twice in sequence. To validate the unique constraint at the storage layer, both executions need to reach the conclusion that no processing record exists at the same time.

Also test changing the requested date while keeping the same ID. The server must neither return the existing result unconditionally nor overwrite the record with the new content. It should report that the requests do not match.

When different requests try to modify the same project version, check that the approval conditions are respected. If one request is applied first, the other should stop so the latest state can be reviewed. A retry of an already completed request should find its existing completion result instead of being mistaken for a version conflict.

Test external notifications in an environment that will not send messages to real customers. Stop the worker after the external service accepts the message but before completion is recorded. Inspect how the recovered worker classifies the item and whether it routes it for verification when the external service has no deduplication support.

Finally, check the response returned after a retry. The earlier change may have succeeded, but another request may since have changed the schedule again. If you mix “that request completed” with “the current deadline is this,” customers may mistake a historical value for the current one.

How much should a small service build?

Not every automation needs a complex execution system. Start by assessing the harm duplicate execution could cause and how much of the outcome you can verify.

For short changes within a database, start with request identification, unique constraints at the operation level, transactions, and result lookup. When something must be sent outside the service, add outgoing message records and a separate worker. For external operations with uncertain outcomes, provide a path for operators to investigate.

Conversely, keeping durable execution records for every step where AI generates an explanation for reference can add substantial maintenance overhead. It is more practical to decide what needs protection based on whether the explanation can be regenerated and whether doing so changes the outcome promised to the customer.

When introducing this design into an existing service, investigate stored duplicates first. If multiple records already share an operation ID, you cannot immediately add a unique constraint. Identify which records represent actual executions, sort out their relationships with associated tasks and notifications, and then apply the constraint.

Avoid deleting duplicate records in bulk. The shape of the data alone may not tell you whether two records were created by mistake or represent two separate customer requests. Items with no traceable basis for execution need individual review.

If I were choosing the next improvement to a deadline change feature, I would consider “View pending change requests” before adding another automation. When customers can find the status of work they have entrusted to the service, they have less reason to submit it again just to check. Assignees can respond using the same record. This is where processing records built for recovery become part of the actual service experience.

References

FAQ

When can duplicate prevention records be deleted?

Considering only how long the interface allows requests to be submitted is not enough. You also need to account for devices reconnecting after being offline, recovery of unfinished work, and operators reprocessing old requests. Decide whether a request arriving after its record has been deleted will be treated as new or rejected as too old. If keeping response bodies for a long time is difficult, consider separate retention periods for the minimal record needed to determine whether processing occurred and for the detailed result.

Should clicking Cancel delete the processing record?

It is better to treat cancellation as a separate state change. Before execution, a worker can check the cancellation state and stop. If the change has already been applied, decide whether a reversing change is needed instead of deleting the original record. Some effects, such as notifications already sent, cannot be undone, so distinguish between acknowledging a cancellation request and confirming that execution actually stopped.

Can the same approach be used for webhooks from other services?

A webhook is a request through which an external service tells our service that an event occurred. The event ID supplied by the sender can be used to identify duplicates. But check whether the event ID differs from the delivery attempt ID. If the sender’s contract assigns a new delivery ID each time the same event is resent, storing only the delivery ID will not prevent duplicate processing. A separate verification step is also needed to confirm that the request came from the legitimate sender.

Which copy of an already duplicated review task should be removed?

First check whether an assignee has started work. Simply deleting a task with comments or deliverables can cause more damage than the duplication itself. Consider choosing a primary task, moving the necessary content into it, and closing the others as duplicates while retaining links between them. If tasks were also created in external systems, record the cleanup result in each system so that a partially completed cleanup is not overlooked.