thedotmack/claude-mem · error

sync hub push: duplicate operation tuple claimed different s

Error message

sync hub push: duplicate operation tuple claimed different sequences

What it means

Thrown when the same operation-tuple key appears more than once in the acked list but with different `seq` values. The hub must assign a single stable sequence to a given operation tuple; a duplicate with a divergent seq is an internal hub inconsistency. Detected via the tupleSeq map keyed by operationTupleKey.

Source

Thrown at src/services/sync/CloudSync.ts:1045

        entity_rev: body.entity_rev,
        operation_sha256: op.operation_sha256,
      });
      sentCounts.set(key, (sentCounts.get(key) ?? 0) + 1);
    }

    const ackCounts = new Map<string, number>();
    const tupleSeq = new Map<string, string>();
    const seqTuple = new Map<string, string>();
    for (const ack of response.acked) {
      const key = operationTupleKey(ack);
      if (!sentCounts.has(key)) {
        throw new Error('sync hub push: 200 response contains an extra or mismatched acknowledgment tuple');
      }
      ackCounts.set(key, (ackCounts.get(key) ?? 0) + 1);

      const priorTupleSeq = tupleSeq.get(key);
      if (priorTupleSeq !== undefined && priorTupleSeq !== ack.seq) {
        throw new Error('sync hub push: duplicate operation tuple claimed different sequences');
      }
      tupleSeq.set(key, ack.seq);

      const priorSeqTuple = seqTuple.get(ack.seq);
      if (priorSeqTuple !== undefined && priorSeqTuple !== key) {
        throw new Error('sync hub push: distinct operation tuples claimed the same sequence');
      }
      seqTuple.set(ack.seq, key);
    }

    for (const [key, expected] of sentCounts) {
      const actual = ackCounts.get(key) ?? 0;
      if (actual !== expected) {
        throw new Error(
          `sync hub push: 200 response acknowledgment multiplicity mismatch (expected ${expected}, received ${actual})`
        );
      }
    }

View on GitHub (pinned to d768ba3643)

Solutions

  1. Capture the full acked array and find the duplicated tuple (same operationTupleKey) — the two differing seq values identify the hub inconsistency.
  2. Report/fi the hub: a single operation tuple must map to exactly one seq.
  3. Retry the push after the hub fix; until then this op batch cannot be safely stamped.
  4. Check hub replication/sequencer logs for the conflicting seq assignments.
Defensive patterns

Strategy: try-catch

Try / catch

try { await cloudSync.push(pushed); }
catch (e) {
  if (e instanceof Error && e.message.includes('duplicate operation tuple claimed different sequences')) {
    // hub sequencer inconsistency; alert ops, do not retry blindly
    logger.error('SYNC', e.message); await backoffBeforeRetry(); return;
  }
  throw e;
}

Prevention

When it happens

Trigger: A 200 push response contains two acked entries with identical (id, kind, entity_rev, operation_sha256) but different `seq` strings. The first occurrence sets tupleSeq[key]; the second with a different seq triggers the throw.

Common situations: Hub bug reassigning sequence numbers on retry/replication, a hub that dedups by a coarser key than the full tuple, or split-brain hub nodes emitting different seqs for the same op. Indicates a correctness bug on the hub side, not a client config issue.

Related errors


AI-assisted analysis of thedotmack/claude-mem@d768ba3643 (2026-08-12). Data as JSON: /api/errors/77fd47a699efdd7a. Report an issue: GitHub.