{"record":{"id":"c6d639da0aa6a7f4","repo":"thedotmack/claude-mem","slug":"sync-hub-status-response-requires-protocol-versio","errorCode":null,"errorMessage":"sync hub status: response requires protocol_version 2","messagePattern":"sync hub status: response requires protocol_version 2","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/services/sync/CloudSync.ts","lineNumber":610,"sourceCode":"      const syncMode = response.headers.get('X-Sync-Mode');\n      if (syncMode !== null || response.ok) this.emitSyncMode(syncMode);\n      if (!response.ok) {\n        const body = (await response.text().catch(() => '')).slice(0, 200);\n        throw new Error(`sync hub status ${response.status}: ${body}`);\n      }\n\n      let parsed: unknown;\n      try {\n        parsed = await response.json();\n      } catch {\n        throw new Error('sync hub status: response is not JSON');\n      }\n      if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {\n        throw new Error('sync hub status: response must be an object');\n      }\n      const record = parsed as Record<string, unknown>;\n      if (record.protocol_version !== 2) {\n        throw new Error('sync hub status: response requires protocol_version 2');\n      }\n      if (\n        typeof record.epoch !== 'string'\n        || typeof record.head_seq !== 'string'\n        || typeof record.projected_seq !== 'string'\n      ) {\n        throw new Error('sync hub status: response requires decimal-string epoch/head_seq/projected_seq');\n      }\n      const epoch = assertCanonicalDecimal(record.epoch, { positive: true });\n      const headSeq = assertCanonicalDecimal(record.head_seq);\n      const projectedSeq = assertCanonicalDecimal(record.projected_seq);\n      if (compareCanonicalDecimals(projectedSeq, headSeq) > 0) {\n        throw new Error('sync hub status: projected_seq exceeds head_seq');\n      }\n      this.hubStatus = {\n        checkedAt,\n        reachable: true,\n        epoch,","sourceCodeStart":592,"sourceCodeEnd":628,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/d768ba364302d12b76e69e4f021f0bb1d2d50ed6/src/services/sync/CloudSync.ts#L592-L628","documentation":"Thrown when the status object's protocol_version field is not strictly equal to 2. The client speaks sync protocol v2 only, so any other value (missing, 1, 3, or wrong type) is a hard contract failure before any sequence field is read.","triggerScenarios":"The hub is running a different protocol major version — an older hub returning protocol_version 1, a newer hub returning 3, or the field missing/misspelled entirely.","commonSituations":"Version skew between the claude-mem client and the sync hub (client upgraded, hub not yet, or vice versa); pointing at a hub built for a different protocol generation; hub deployment partially rolled out.","solutions":["Check the hub's deployed version and its supported protocol_version.","Upgrade or downgrade the hub so it speaks protocol_version 2.","Upgrade the claude-mem client to the version matching the hub's protocol.","Confirm you are pointed at the correct hub environment for this client version."],"exampleFix":"// before: client v2 against a hub still on protocol v1\n// hub /v1/sync/status -> {\"protocol_version\":1,...}\n// after: hub upgraded to v2\n// hub /v1/sync/status -> {\"protocol_version\":2,...}","handlingStrategy":"validation","validationCode":null,"typeGuard":"function isHubProtocolMismatch(e: unknown): boolean {\n  return e instanceof Error && /sync hub status: response requires protocol_version 2/i.test(e.message);\n}","tryCatchPattern":"try { await cloudSync.status(); }\ncatch (e) { if (isHubProtocolMismatch(e)) { markHubIncompatible(e.message); /* disable sync */ return; } throw e; }","preventionTips":["Deploy hub and client versions that both speak protocol_version 2.","Run a version-compatibility check at start-up and disable sync gracefully on mismatch.","Coordinate hub rollouts so clients are not pointed at a different-protocol hub."],"tags":["cloud-sync","hub","protocol-version","version-skew"],"backgroundTag":null,"analyzedSha":"d768ba364302d12b76e69e4f021f0bb1d2d50ed6","analyzedAt":"2026-08-12T23:52:55.241Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}