{"record":{"id":"77fd47a699efdd7a","repo":"thedotmack/claude-mem","slug":"sync-hub-push-duplicate-operation-tuple-claimed-d","errorCode":null,"errorMessage":"sync hub push: duplicate operation tuple claimed different sequences","messagePattern":"sync hub push: duplicate operation tuple claimed different sequences","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/services/sync/CloudSync.ts","lineNumber":1045,"sourceCode":"        entity_rev: body.entity_rev,\n        operation_sha256: op.operation_sha256,\n      });\n      sentCounts.set(key, (sentCounts.get(key) ?? 0) + 1);\n    }\n\n    const ackCounts = new Map<string, number>();\n    const tupleSeq = new Map<string, string>();\n    const seqTuple = new Map<string, string>();\n    for (const ack of response.acked) {\n      const key = operationTupleKey(ack);\n      if (!sentCounts.has(key)) {\n        throw new Error('sync hub push: 200 response contains an extra or mismatched acknowledgment tuple');\n      }\n      ackCounts.set(key, (ackCounts.get(key) ?? 0) + 1);\n\n      const priorTupleSeq = tupleSeq.get(key);\n      if (priorTupleSeq !== undefined && priorTupleSeq !== ack.seq) {\n        throw new Error('sync hub push: duplicate operation tuple claimed different sequences');\n      }\n      tupleSeq.set(key, ack.seq);\n\n      const priorSeqTuple = seqTuple.get(ack.seq);\n      if (priorSeqTuple !== undefined && priorSeqTuple !== key) {\n        throw new Error('sync hub push: distinct operation tuples claimed the same sequence');\n      }\n      seqTuple.set(ack.seq, key);\n    }\n\n    for (const [key, expected] of sentCounts) {\n      const actual = ackCounts.get(key) ?? 0;\n      if (actual !== expected) {\n        throw new Error(\n          `sync hub push: 200 response acknowledgment multiplicity mismatch (expected ${expected}, received ${actual})`\n        );\n      }\n    }","sourceCodeStart":1027,"sourceCodeEnd":1063,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/d768ba364302d12b76e69e4f021f0bb1d2d50ed6/src/services/sync/CloudSync.ts#L1027-L1063","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Capture the full acked array and find the duplicated tuple (same operationTupleKey) — the two differing seq values identify the hub inconsistency.","Report/fi the hub: a single operation tuple must map to exactly one seq.","Retry the push after the hub fix; until then this op batch cannot be safely stamped.","Check hub replication/sequencer logs for the conflicting seq assignments."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { await cloudSync.push(pushed); }\ncatch (e) {\n  if (e instanceof Error && e.message.includes('duplicate operation tuple claimed different sequences')) {\n    // hub sequencer inconsistency; alert ops, do not retry blindly\n    logger.error('SYNC', e.message); await backoffBeforeRetry(); return;\n  }\n  throw e;\n}","preventionTips":["Treat this as a hub-side integrity bug; add monitoring for duplicate-tuple/divergent-seq responses.","Do not auto-retry in a tight loop — a hub sequencer fault needs time to recover.","Capture the acked array on this error to attach to the hub bug report."],"tags":["sync","cloud-sync","hub-response","validation","sequence-integrity"],"backgroundTag":null,"analyzedSha":"d768ba364302d12b76e69e4f021f0bb1d2d50ed6","analyzedAt":"2026-08-12T23:52:55.241Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}