{
  "id": "redis/sync-replica-id-mismatch",
  "signature": "Error: Replication sync failed, replica id mismatch, expected <replica_id> but got <replica_id>",
  "signature_zh": "错误：复制同步失败，副本ID不匹配，期望<replica_id>但得到<replica_id>",
  "regex": "Error: Replication sync failed, replica id mismatch, expected .+ but got .+",
  "domain": "redis",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "During partial resynchronization, the replica's cached master replication ID does not match the current master's replication ID, often due to master restart or failover.",
  "root_cause_type": "generic",
  "root_cause_zh": "在部分重新同步期间，副本缓存的master复制ID与当前master的复制ID不匹配，通常是由于master重启或故障转移导致。",
  "versions": [
    {
      "version": "6.2.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "7.0.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "7.2.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "7.4.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Restarting the replica without clearing its replication backlog or ID cache does not fix the underlying mismatch; the replica will retry with the same stale ID.",
      "fail_rate": 0.75,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Manually setting repl-id using CONFIG SET on the master is risky and may break replication for other replicas; it does not address the root cause of ID divergence.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Increasing repl-backlog-size on the master alone does not resolve a mismatched replication ID; the replica must perform a full sync to reset the ID.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "On the replica, run `SLAVEOF NO ONE` then `SLAVEOF <master_ip> <master_port>` to force a full resynchronization.",
      "success_rate": 0.95,
      "how": "On the replica, run `SLAVEOF NO ONE` then `SLAVEOF <master_ip> <master_port>` to force a full resynchronization.",
      "condition": "",
      "sources": []
    },
    {
      "action": "If using Redis Sentinel, trigger a manual failover: `redis-cli -p 26379 SENTINEL failover <mymaster>` to elect a new master and force replicas to sync with a fresh replication ID.",
      "success_rate": 0.85,
      "how": "If using Redis Sentinel, trigger a manual failover: `redis-cli -p 26379 SENTINEL failover <mymaster>` to elect a new master and force replicas to sync with a fresh replication ID.",
      "condition": "",
      "sources": []
    },
    {
      "action": "In a cluster environment, use `CLUSTER REPLICATE <node-id>` on the replica after ensuring the master is healthy and has a consistent replication ID.",
      "success_rate": 0.9,
      "how": "In a cluster environment, use `CLUSTER REPLICATE <node-id>` on the replica after ensuring the master is healthy and has a consistent replication ID.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "在副本上运行 `SLAVEOF NO ONE` 然后 `SLAVEOF <master_ip> <master_port>` 以强制完全重新同步。",
    "如果使用Redis Sentinel，触发手动故障转移：`redis-cli -p 26379 SENTINEL failover <mymaster>` 以选举新的master并强制副本使用新的复制ID同步。",
    "在集群环境中，确保master健康且复制ID一致后，在副本上使用 `CLUSTER REPLICATE <node-id>`。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://redis.io/docs/management/replication/",
  "official_doc_section": null,
  "error_code": "ERR",
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.88,
  "resolvable": "true",
  "first_seen": "2023-11-15",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}