Skip to content

Two-Way Sync Error Handling: Retries and Replay

Design recoverable two-way sync: classify failures, prevent duplicate effects, distinguish retry from replay, and reconcile records after an outage.

Author
Stacksync · Data engineering writer
Published
Read time
7 min read
Two-Way Sync Error Handling: Retries and Replay
DATA ENGINEERING

A retry is safe only when you know what it repeats

Reliable two-way sync error handling separates temporary delivery failures from invalid records, preserves record identity during retries, and checks the destination after recovery. Retry, replay, and reconciliation are different operations: a retry attempts delivery again, replay processes historical changes, and reconciliation compares the current states to find differences.

The distinction matters when a CRM update reaches an ERP but the acknowledgment is lost. Retrying a blind create may produce a second customer. Replaying an old value may overwrite a later correction. Marking the error resolved without checking the target may hide a broken business workflow.

This guide explains the architectural choices and a practical recovery procedure. The generic patterns describe requirements you should verify in any integration. The Stacksync section identifies the behavior documented for its Issues dashboard without assuming it is an event-history replay service.

Classify the failure before deciding to retry

An HTTP error alone rarely explains the business outcome. Combine the status with the endpoint’s response, the record identity, and what happened at the destination. A timeout is ambiguous: the target may have committed the write before the response was lost.

FailureFirst actionWhen to try again
Rate limit or temporary service outageRespect the provider’s retry guidance; reduce pressureAfter the advised wait, within a bounded retry budget
Network timeout after sending a writeLook up the operation or record by its stable identityWhen duplicate effects are prevented or the prior result is known
Missing permission or expired authorizationRepair the connection or access policyAfter the intended identity passes an access test
Invalid enum, type or required fieldCorrect the data or mappingAfter a representative record passes validation
Missing parent relationshipResolve the parent identity and creation orderAfter the dependency is available
Unsupported write or immutable fieldChange the scope or designOnly after the destination supports the intended operation

Avoid repeatedly sending a value that a validation rule will always reject. Retrying such a record consumes capacity and delays healthy records. Preserve the error context in a visible exception queue and assign an owner who can decide whether to correct the data, alter the mapping, or intentionally exclude the field.

Temporary delivery problems need controlled retries; invalid records need correction; an uncertain write needs identity-based verification.
Temporary delivery problems need controlled retries; invalid records need correction; an uncertain write needs identity-based verification.

Prevent duplicate business effects

Idempotency means repeating the same logical operation does not add another effect. For a sync, stable record matching is necessary, but it is not always sufficient. Updating a contact twice may be harmless while firing an automation twice can create two orders or send two messages.

Use a stable operation identifier when the receiving API supports one. Keep that identifier unchanged across attempts for the same operation; use a different identifier for a genuinely new action. Record the source entity, logical operation, target identity, and known result so that recovery can answer “did this already happen?” AWS’s idempotent API guidance explains why caller-provided request identifiers help make retries safe.

Do not deduplicate all changes to a record using the record ID alone. A second legitimate update has the same record ID but different intent. Conversely, do not generate a new random operation ID every time the same request is retried. Test both cases: repeat the same update, then make a new update to the same entity.

After an ambiguous acknowledgment, retry the same operation identity and verify the existing outcome before applying another business effect.
After an ambiguous acknowledgment, retry the same operation identity and verify the existing outcome before applying another business effect.

A destination upsert can prevent a second record when its unique key is correct; it does not automatically prevent downstream side effects. Include destination workflows, triggers, notifications, and financial actions in your duplicate test. Document what is protected by the sync layer and what requires protection in the receiving application.

Bound retries so an outage does not become overload

Choose timeouts, a maximum retry budget, and increasing delays with jitter. Jitter spreads retries over time so many blocked records do not hit a recovering API together. Honor a valid Retry-After instruction when provided, and coordinate retries with the connector’s quota and concurrent requests.

Retry at one owned layer where possible. If a client, worker, and workflow each repeat a call, their attempts can multiply. AWS’s retry-control guidance recommends limiting retry pressure and verifying idempotency. Your acceptance test should include a sustained outage, not just a single artificial error.

  • Measure both new traffic and backlog traffic against the same destination limits.
  • Keep retries for one rejected record from starving unrelated healthy records.
  • Escalate when retry age exceeds the workflow’s freshness target.
  • Record the last error and next action; a retry counter alone is insufficient.
  • Require a deliberate decision before retrying a non-idempotent create with an unknown result.

There is no universal retry count that makes every connector reliable. A short-lived rate limit and a missing administrator permission need different responses. Tune the policy to the endpoint, the recovery objective, and the cost of repeating the business action.

Distinguish historical replay from current-state repair

Historical replay requires the original change, a retained history, and a policy for ordering it against newer changes. Current-state repair reads what the source says now and attempts to bring the destination into agreement. Both can be useful; they solve different problems.

OperationInputMain risk to test
Retry the original eventThe original operation and payloadDuplicate effects or an expired idempotency window
Replay retained historyA selected historical sequenceOld events overwriting newer state or recreating deleted entities
Repair from current sourceThe latest authoritative valueLosing an intermediate transition required by a business process
Reconcile current stateBoth systems’ current keys and valuesMistaking intentional differences or filtered records for errors

For example, a shipment may move from packed to shipped to delivered during an outage. A customer-facing status field may only need “delivered.” A billing workflow that must act on the “shipped” transition may require preserved event history. Decide which contract applies before choosing a recovery action.

Keep replay scope narrow: select the time window, entities, mapping version, and expected target state. Test a small representative set before expanding. A successful replay job is not proof of correctness; compare affected record identities and critical values afterward.

Two systems, one record, no batch window
See your own stack synced live. Book a demo with the engineers who built it.
Book a demo

What the Stacksync Issues dashboard does

The Issues dashboard documentation describes three actions. Retry to sync reads the source record’s latest values and attempts the write again. Revert change reads the corresponding destination values and writes them back to the source. Ignore issue removes the issue from the dashboard and can leave different values in the two systems. Bulk resolution is also documented.

That retry behavior is current-state repair, so do not assume it reproduces an older event payload. Before choosing an action, inspect both records and confirm which value the business wants to keep. Reverting is an additional write, not merely dismissing an alert.

After resolving the immediate issue, check dependent records and the original business outcome. A contact may now be current while its company association or a downstream workflow still needs attention. Use the dashboard together with explicit reconciliation, rather than treating the absence of visible issues as an end-to-end proof.

A recovery procedure your team can rehearse

  • 01Identify the affected system, objects, first failure time, stable record IDs, and current business impact.
  • 02Classify the failure and determine whether the destination may already have applied the operation.
  • 03Choose the authoritative state and the intended recovery method: retry, current-state repair, historical replay, or reconciliation.
  • 04Fix the underlying permission, validation, dependency, capacity, or mapping problem.
  • 05Test one representative record and inspect both systems plus downstream side effects.
  • 06Process a bounded batch while watching destination pressure and unresolved issue age.
  • 07Reconcile affected identities, values, relationships, and business totals. Record exceptions and owners.
  • 08Close the incident only after the outcome is verified; add the failure to the release test set.

Download this recovery runbook. Pair it with the production-readiness checklist and field mapping workbook. For a concrete connector review, bring a failing-record example to a Stacksync demo using test data and the exact write behavior you need to verify.

Start with one sync and see it hold
Connect two systems, watch a record move both ways, then decide.
Start syncing

FAQ

Frequently asked questions

What is the difference between retry and replay?
A retry attempts an operation again after failure. Replay processes retained historical changes. Some sync tools instead retry by re-reading current source values; confirm which behavior your recovery action uses.
Does Stacksync Retry to sync replay the original event?
The Issues dashboard documentation says Retry to sync queries the source record again and syncs its latest values. That is current-state repair, not a promise to replay an immutable original event.
How do I prevent duplicate records during retries?
Use stable cross-system identity and a destination operation that is safe to repeat. Also test downstream workflows, since preventing duplicate records does not automatically prevent duplicate business side effects.
Should I automatically retry validation errors?
First correct the value, mapping, or validation requirement. Repeating an unchanged invalid request will usually fail again and consume capacity needed by healthy records.
Coworkers laughing in front of a laptop in a casual office setting

You just read how it should work.
See it run on your own data.