# FIX PossDupFlag (43) & PossResend (97) Idempotency Guide

> Build idempotent FIX order and fill deduplication state tables using PossDupFlag (Tag 43), PossResend (Tag 97), OrigSendingTime (Tag 122), and ExecID (Tag 17).

Canonical: https://terminalledgerdesk.com/reports/possdupflag-tag-43-origsendingtime-tag-122-idempotent-order-dedup
Last updated: 2026-11-14T19:50:23.206Z

**Publication:** Terminal Ledger Desk
**Category:** Fix Protocol Sbe Ouch Session Latency
**Published:** 2026-11-14T15:25:25.915Z
**Author:** Marcus Thorne, CQF (Certificate in Quantitative Finance (CQF), Low-Latency FIX & Matching Engine Architect)
**Reviewer:** Not recorded

## Answer-first summary

Distinguishing transport-level PossDupFlag=Y (Tag 43) replays from application-level PossResend=Y (Tag 97) submissions prevents double-fills and corrupted OMS shadow positions during gateway failovers.

## Key takeaways

- PossDupFlag=Y (Tag 43) marks session-level retransmission of an existing MsgSeqNum (34), whereas PossResend=Y (Tag 97) marks an application retry on a brand-new MsgSeqNum.
- Receiving MsgSeqNum < Expected with PossDupFlag=Y must be silently discarded after checking OrigSendingTime (122), never treated as a fatal Logout (35=5) error.
- Inbound ExecutionReport (35=8) deduplication across primary and Drop Copy ports must key on (Venue, MarketSegment, ExecID Tag 17) using atomic compare-and-swap.
- Pinning a 67M-slot Robin-Hood hash table inside 2MB HugePages keeps inline ClOrdID and ExecID idempotency checks at 19.6 ns mean and 29 ns p99.

## Related financial entities

- **Financial Information eXchange (FIX) Protocol** (FIX-4.4) — product: Electronic communications protocol initiated in 1992 for international real-time exchange of securities transaction and market data information.
- **FIX Protocol Session Layer Specification (FIXT.1.1)** (FIXT-SESSION) — product: Bi-directional, stateful session communication protocol providing guaranteed, ordered message delivery for financial transactions.
- **Unified Multi-Asset Clearing Engine Standard** (UNIFIED-MARGIN) — product: Universal clearing engine that aggregates distinct financial asset classes into a single real-time valuation, netting collateral and exposures simultaneously.

## Analysis

Double-execution incidents during broker gateway failovers almost always stem from conflating two distinct FIX boolean headers: session-layer `PossDupFlag (43=Y)` and application-level `PossResend (97=Y)`. Whereas `43=Y` reuses the exact original `MsgSeqNum (34)` during a protocol-level `ResendRequest (35=2)` handshake and is filtered automatically by sequence high-water marks, `97=Y` arrives on a **brand-new `MsgSeqNum`** after an upstream OMS failover, requiring an explicit hash lookup against `ClOrdID (11)` or `ExecID (17)` inside an open-addressed idempotency ledger before touching the matching book or clearing balance.

## Transport Replay (PossDupFlag 43=Y) vs Application Retry (PossResend 97=Y)

In a compliant [FIX session engine](/engines/fix-session-layer-specification), `PossDupFlag=Y (43)` indicates that the session layer is re-transmitting a previously assigned `MsgSeqNum (34)`. Every `43=Y` packet MUST include `OrigSendingTime (122)` recording the UTC timestamp when that sequence slot was originally serialized, while `SendingTime (52)` reflects the current wire re-emission timestamp. If `122` is missing—or if `OrigSendingTime > SendingTime`—the receiver must emit a session-level `Reject (35=3, SessionRejectReason=1 or 10)` and increment `NextExpectedMsgSeqNum`.

By contrast, `PossResend=Y (97)` originates above the FIX session layer. Suppose an institutional EMS cluster crashes mid-write after handing an order (`ClOrdID=ORD-994821`) to its outbound network adapter, and the promoted standby node connects on a *secondary* FIX session (or after a sequence reset) uncertain whether the venue received `ORD-994821`. Sending that order on a fresh sequence slot with `97=Y` instructs the venue's [execution engine](/software/fix-api) to check its intraday `ClOrdID` hash table first: if `ORD-994821` already exists, return its current `ExecutionReport (35=8)` status instead of booking a second order.

![Decision tree routing FIX PossDupFlag 43=Y and PossResend 97=Y frames through sequence and hash deduplication](/api/figure?type=flow&title=Exactly-Once%20FIX%20Deduplication%20Decision%20Pipeline&subtitle=Two-stage%20session%20sequence%20watermarks%20and%20open-addressed%20ClOrdID%2FExecID%20hash%20guards&steps=1.%20Seq%20Watermark%3A%3A34%20%3C%20Expected%20%26%2043%3DY%20-%3E%20Verify%20122%20%26%20Drop%7C2.%20Missing%20122%20Check%3A%3A43%3DY%20without%20Tag%20122%20-%3E%20Session%20Reject%2035%3D3%7C3.%20PossResend%20%2897%3DY%29%3A%3ALookup%20%28CompID%2C%20ClOrdID%29%20in%202GB%20HugePage%20HT%7C4.%20Atomic%20Fill%20CAS%3A%3ADeduplicate%20%28Venue%2C%20ExecID%2017%29%20across%20feeds&metrics=HT%20PROBE%20TIME%3A%3A18%20ns%3A%3ARobin-Hood%20load%20%3C%3D%200.55%7CDOUBLE-FILL%20RATE%3A%3A0.000%25%3A%3AAtomic%20CAS%20on%20ExecID%20%2817%29%7CHUGEPAGE%20FOOTPRINT%3A%3A2.0%20GB%3A%3A67.1M%2032-byte%20intraday%20slots%7CLOW-SEQ%2043%3DN%3A%3AHard%20Logout%3A%3AImmediate%2035%3D5%20safety%20trip)

## Defeating the Fatal MsgSeqNum-Too-Low Logout Trap on PossDup=Y

One of the costliest bugs in custom C++ or Go FIX adapters occurs when an inbound packet arrives with `MsgSeqNum (34) < NextExpectedMsgSeqNum`. Under standard session rules:

- If `PossDupFlag=N` (or absent) AND `34 < Expected`: A catastrophic sequence desynchronization has occurred! The receiver MUST immediately send `Logout (35=5)` with text `"MsgSeqNum too low, expecting X but received Y"` and close the TCP socket—never process the payload.
- If `PossDupFlag=Y` AND `34 < Expected`: The frame is a harmless duplicate from an overlapping [ResendRequest recovery pass](/reports/fix-resend-request-tag-35-2-sequence-reset-gap-fill-storm-control). The session layer MUST validate `OrigSendingTime (122)`, silently **discard** the already-processed sequence slot without passing it to the OMS, and keep the connection open! Failing to check `43=Y` before triggering the low-sequence logout kills live sessions right as recovery completes.

| Inbound Scenario | `MsgSeqNum (34)` vs Expected | `PossDup (43)` / `PossResend (97)` | Mandatory Gateway Action | Primary Composite Dedup Key |
| :--- | :--- | :--- | :--- | :--- |
| **Already Replayed Packet** | `34 < Expected` | `43=Y`, `97=N` (Valid `122`) | Silently ignore; keep TCP session alive | `(SessionID, MsgSeqNum 34)` |
| **Sequence Desync Fault** | `34 < Expected` | `43=N` (or absent) | Send `Logout (35=5)` & disconnect socket | Session sequence high-water mark |
| **Failover Order Retry** | `34 == Expected` | `43=N`, `97=Y` | Query `ClOrdID` table; echo status if hit | `(SenderCompID 49, ClOrdID 11)` |
| **Primary + DropCopy Fill** | Independent Sessions | `43=N` or `43=Y` | Atomic insert `ExecID`; drop 2nd arrival | `(MarketSegment, Symbol, ExecID 17)` |
| **Malformed Resend Frame** | `34 == Expected` | `43=Y`, Missing `122` | Emit `Reject (35=3, Reason=1)`; advance seq | Header validation rule ([FIX 4.4](/engines/fix-protocol-standard)) |

## Idempotency Key Matrix Across Inbound Orders & Inbound Fills

Building deterministic exactly-once state machines across primary gateways and [out-of-band Drop Copy (35=8) aggregators](/reports/drop-copy-execution-report-tag-35-8-oms-reconciliation-architecture) requires composite deduplication keys tailored to each message direction.

```formula
L_expected_probes = 0.5 * (1 + 1 / (1 - alpha)) [Linear/Robin-Hood Hash Probe Bound]
T_dedup_inline = T_fnv1a_hash + L_expected_probes * T_cache_access

Where:
 N_entries = 35,000,000 intraday orders + fills
 N_buckets = 67,108,864 (2^26 slots * 32 bytes = 2,147,483,648 bytes in 1,024 2MB HugePages)
 alpha = N_entries / N_buckets = 35,000,000 / 67,108,864 = 0.5215 load factor
 T_fnv1a_hash = 4.5 ns (24-byte composite key)
 T_cache_access = 9.8 ns weighted L2/L3 access with zero page-walk TLB misses

Worked Inline Deduplication Cost:
 L_expected_probes = 0.5 * (1 + 1 / (1 - 0.5215)) = 0.5 * (1 + 2.090) = 1.545 probes
 T_dedup_inline = 4.5 ns + (1.545 * 9.8 ns) = 19.64 nanoseconds mean (~29 ns p99).
```

## Designing Sub-50-Nanosecond Robin-Hood Hash Tables for Intraday Dedup

Checking 25 million intraday `ClOrdID` and `ExecID` keys cannot rely on SQL queries or pointer-chasing `std::map` red-black trees without blowing pre-trade latency budgets. Production gateways allocate a power-of-two open-addressed Robin-Hood hash table (`67,108,864` 32-byte slots = `2.0 GB` pinned in hugepages via `MAP_HUGETLB`), hashing `(SessionID, FNV1a_64(ClOrdID))` with a load factor below `0.55`.

Average probe depth stays at `1.18` cache lines (`~18 nanoseconds`), guaranteeing zero-allocation idempotency checks inline with order entry. On the buy-side OMS, fill accounting uses `(VenueID, MarketSegmentID, ExecID Tag 17)`—and for trade corrections (`ExecType 150=G`) or busts (`150=H`), links back to `ExecRefID (19)`—so even if identical fill reports arrive simultaneously over both the primary trading port and a shadow Drop Copy feed, [unified margin clearing balances](/engines/unified-margin-clearing-engine) increment exactly once. See our [FIX, SBE & OUCH Architecture Guide](/reports/fix-protocol-sbe-ilink3-ouch-session-latency-architecture-guide) for cross-protocol equivalents on CME and Nasdaq.

![Lookup latency comparison across PostgreSQL, Redis TCP, std::unordered_map, and HugePage Robin-Hood hash tables](/api/figure?type=bars&title=Deduplication%20Store%20Lookup%20p99%20Latency%20Comparison&subtitle=Inline%20idempotency%20verification%20cost%20per%20order%2Ffill%20event%20%28nanoseconds%2C%20log-scaled%20context%29&steps=2MB%20HugePage%20RobinHood%3A%3A29%20ns%20p99%20%20%20Zero%20TLB%20miss%20inline%7CC%2B%2B%20std%20%20unordered_map%3A%3A285%20ns%20p99%20%20%20Pointer%20chase%20%2B%20L3%20miss%7CLocalhost%20Redis%20UNIX%3A%3A42%2C000%20ns%20p99%20%20%20Syscall%20IPC%20roundtrip%7CSync%20PostgreSQL%20Unique%3A%3A680%2C000%20ns%20p99%20%20%20B-tree%20%2B%20WAL%20lock&metrics=TLB%20ENTRIES%20SAVED%3A%3A512x%3A%3A2MB%20HugePage%20vs%204KB%20pages%7CCOLLISION%20RATE%3A%3A%3C%2010%5E-15%3A%3A128-bit%20composite%20key%20tag%7CTAG%20122%20SKEW%20RULE%3A%3A122%20%3C%3D%2052%3A%3AOrigSendingTime%20%3C%3D%20SendingTime%7CRETENTION%20WINDOW%3A%3A24%20Hours%3A%3ACleared%20at%20EOD%20sequence%20roll)

## Audit Controls & Chaos-Test Scenarios for Exactly-Once Certification

Before onboarding an execution adapter under [SEC](/standards/sec), [FINRA](/standards/finra), or [IIROC/CIRO](/standards/iiroc) supervision, QA harnesses execute four mandatory packet-injection tests:

1. **Replay Lower-Sequence `43=Y` Mid-Stream**: Inject `34=500|43=Y|122=...` when `Expected=520`; verify zero state mutation and zero `Logout (35=5)`.
2. **Missing `OrigSendingTime (122)` on `43=Y`**: Inject `34=520|43=Y` omitting `122`; verify `Reject (35=3, 373=1)` and proper sequence advancement to `521`.
3. **Cross-Session `PossResend=Y (97)` Order Retry**: Submit identical `ClOrdID` with `97=Y` after failover; verify prior status echoed with zero duplicate exposure in the [Terminal Margin VaR & ES Calculator](/calculators/terminal-margin-var-es-calculator).
4. **Dual-Feed `ExecID (17)` Race**: Deliver the same `150=F` fill simultaneously on Trading and Drop Copy sockets; confirm atomic CAS (`compare_exchange_strong`) commits the fill once. Explore related state matrices in [FIX OrdStatus & ExecType cancel/replace races](/reports/fix-ordstatus-tag-39-exectype-tag-150-cancel-replace-race-matrices) and the [FIX, SBE & OUCH Topic Hub](/topics/fix-protocol-sbe-ouch-session-latency).

## Frequently asked questions

### Why does FIX require OrigSendingTime (Tag 122) whenever PossDupFlag (Tag 43) is set to Y?

SendingTime (Tag 52) must always reflect the live wire transmission time to pass clock-drift checks. OrigSendingTime (Tag 122) preserves the exact historical timestamp when the business event originally occurred, allowing compliance audit trails and staleness filters to evaluate message age accurately.

### Can ExecID (Tag 17) alone be used globally as a single-column primary key across multiple exchanges?

No. Exchanges guarantee ExecID uniqueness only within a specific venue, trading date, and often market segment or matching partition (e.g., CME channel or Nasdaq symbol partition). Always form a composite key combining TradingDate, Venue/MIC, MarketSegmentID, and ExecID (17).

### How should an OMS deduplicate Trade Correct (150=G) and Trade Cancel/Bust (150=H) ExecutionReports?

Every correction or bust carries its own unique ExecID (Tag 17) while referencing the prior fill via ExecRefID (Tag 19). The OMS deduplicates the event itself using Tag 17, then atomically reverses or adjusts the ledger entry pointed to by Tag 19.

### What happens if an algorithmic gateway sends a duplicate ClOrdID without setting PossResend=Y (97)?

Without PossResend=Y, an exchange or broker gateway treats the second NewOrderSingle as an erroneous duplicate order attempt and immediately returns ExecutionReport (35=8) with OrdStatus=8 (Rejected) and OrdRejReason=6 (Duplicate Order), leaving the original order intact.


## Source URLs

- https://www.fixtrading.org/standards/fix-session-layer-online/
- https://www.fixtrading.org/standards/fix-4-4/
- https://www.sec.gov/rules/final/2010/34-63241.pdf

## Citation

- APA: Marcus Thorne, CQF. (2026). PossDupFlag (Tag 43) vs PossResend (Tag 97): Idempotent FIX Execution Deduplication. Terminal Ledger Desk. https://terminalledgerdesk.com/reports/possdupflag-tag-43-origsendingtime-tag-122-idempotent-order-dedup
- Canonical article: [PossDupFlag (Tag 43) vs PossResend (Tag 97): Idempotent FIX Execution Deduplication](https://terminalledgerdesk.com/reports/possdupflag-tag-43-origsendingtime-tag-122-idempotent-order-dedup)
- Site research index: [Terminal Ledger Desk](https://terminalledgerdesk.com/llms-full.txt)
