{"record":{"id":"f93e0925e96b98df","repo":"thedotmack/claude-mem","slug":"sync-hub-push-200-response-acknowledgment-multipl","errorCode":null,"errorMessage":"sync hub push: 200 response acknowledgment multiplicity mismatch (expected ${expected}, received ${actual})","messagePattern":"sync hub push: 200 response acknowledgment multiplicity mismatch \\(expected (.+?), received (.+?)\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/services/sync/CloudSync.ts","lineNumber":1059,"sourceCode":"      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    }\n    if (ackCounts.size !== sentCounts.size) {\n      // Defensive: the unknown-tuple branch above should make this impossible.\n      throw new Error('sync hub push: 200 response acknowledgment multiset mismatch');\n    }\n\n    if (compareCanonicalDecimals(response.head_seq, response.projected_seq) > 0) {\n      throw new Error('sync hub push: checkpoint order requires head_seq <= projected_seq');\n    }\n    for (const ack of response.acked) {\n      if (compareCanonicalDecimals(ack.seq, response.head_seq) > 0) {\n        throw new Error('sync hub push: acknowledgment seq exceeds head_seq');\n      }\n      if (compareCanonicalDecimals(ack.seq, response.projected_seq) > 0) {\n        throw new Error('sync hub push: sent operation is not covered by projected_seq');","sourceCodeStart":1041,"sourceCodeEnd":1077,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/d768ba364302d12b76e69e4f021f0bb1d2d50ed6/src/services/sync/CloudSync.ts#L1041-L1077","documentation":"Thrown when, for some sent operation tuple, the number of acks received does not equal the number sent. Built from sentCounts (how many of each tuple the client pushed) vs ackCounts (how many the hub acked). A mismatch means the hub under- or over-acknowledged a tuple that DOES exist (extra/unknown tuples are caught earlier by [122]).","triggerScenarios":"validatePushResponse iterates sentCounts and finds ackCounts.get(key) !== expected. Example: client sent 3 of the same tuple, hub acked only 2 (or 4). The message names the exact tuple count and received count.","commonSituations":"Hub silently dropped a duplicate operation, deduped identical tuples incorrectly, or acked an extra copy. Also from a hub that batches/merges identical operations differently than the client's per-op push granularity. Indicates the hub's acknowledgment multiset does not equal the sent multiset.","solutions":["Use the (expected, received) counts in the message to see whether the hub under- or over-acked that tuple.","Confirm the client is not double-adding identical WireOps to the push payload, and that the hub is not collapsing duplicates.","Ensure hub and client agree on whether identical tuples are pushed/acked once-per-op or deduped.","Re-run the push; a persistent mismatch for the same tuple indicates a hub dedup bug."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// You can pre-dedup your pushed payload to avoid sending duplicate tuples\n// that the hub may collapse:\nfunction dedupPushed(pushed: WireOp[]): WireOp[] {\n  const seen = new Set<string>();\n  return pushed.filter(op => {\n    const body = parseCanonicalOperation(op);\n    const key = JSON.stringify([body.id, body.kind, body.entity_rev, op.operation_sha256]);\n    if (seen.has(key)) return false; seen.add(key); return true;\n  });\n}","typeGuard":null,"tryCatchPattern":"try { await cloudSync.push(pushed); }\ncatch (e) {\n  if (e instanceof Error && e.message.includes('acknowledgment multiplicity mismatch')) {\n    logger.error('SYNC', e.message); // (expected, received) in message\n    return;\n  }\n  throw e;\n}","preventionTips":["Dedup identical WireOps before pushing so sent counts are intentional.","Confirm the hub acks once-per-pushed-op (not a coarser dedup).","Use the (expected, received) counts in the message to drive the hub dedup investigation."],"tags":["sync","cloud-sync","hub-response","validation","multiset"],"backgroundTag":null,"analyzedSha":"d768ba364302d12b76e69e4f021f0bb1d2d50ed6","analyzedAt":"2026-08-12T23:52:55.241Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}