{
  "id": "kafka/replica-not-available-on-fetch",
  "signature": "org.apache.kafka.common.errors.ReplicaNotAvailableException: Replica for partition my_topic-0 is not available on broker 2",
  "signature_zh": "org.apache.kafka.common.errors.ReplicaNotAvailableException: 分区 my_topic-0 的副本在代理 2 上不可用",
  "regex": "ReplicaNotAvailableException.*Replica for partition .* is not available on broker",
  "domain": "kafka",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "A follower replica is not fully caught up with the leader and cannot serve fetch requests, often due to replication lag or the replica being offline.",
  "root_cause_type": "generic",
  "root_cause_zh": "跟随者副本未完全跟上领导者，无法提供获取请求，通常是由于复制延迟或副本离线。",
  "versions": [
    {
      "version": "kafka_2.13-3.4.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "kafka_2.13-3.5.1",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "kafka_2.13-3.6.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "This reduces durability but does not make the replica available; the follower still lags and cannot serve fetches.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "This controls fetch size, not lag; the replica is not available due to being out of sync, not due to fetch limits.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "This removes the replica entirely, causing data loss and requiring re-replication, which may make it even less available.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Check the replication lag using `kafka-consumer-groups.sh --bootstrap-server localhost:9092 --group my-group --describe` and verify the replica is in sync. If lag is high, increase `replica.fetch.max.bytes` and `num.replica.fetchers` on the broker.",
      "success_rate": 0.85,
      "how": "Check the replication lag using `kafka-consumer-groups.sh --bootstrap-server localhost:9092 --group my-group --describe` and verify the replica is in sync. If lag is high, increase `replica.fetch.max.bytes` and `num.replica.fetchers` on the broker.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Restart the broker hosting the unavailable replica (broker 2) to force re-sync with the leader. Example: `systemctl restart kafka` on broker 2.",
      "success_rate": 0.8,
      "how": "Restart the broker hosting the unavailable replica (broker 2) to force re-sync with the leader. Example: `systemctl restart kafka` on broker 2.",
      "condition": "",
      "sources": []
    },
    {
      "action": "If the replica is permanently stuck, reassign the partition to a different broker using `kafka-reassign-partitions.sh` with a custom reassignment JSON.",
      "success_rate": 0.9,
      "how": "If the replica is permanently stuck, reassign the partition to a different broker using `kafka-reassign-partitions.sh` with a custom reassignment JSON.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Check the replication lag using `kafka-consumer-groups.sh --bootstrap-server localhost:9092 --group my-group --describe` and verify the replica is in sync. If lag is high, increase `replica.fetch.max.bytes` and `num.replica.fetchers` on the broker.",
    "Restart the broker hosting the unavailable replica (broker 2) to force re-sync with the leader. Example: `systemctl restart kafka` on broker 2.",
    "If the replica is permanently stuck, reassign the partition to a different broker using `kafka-reassign-partitions.sh` with a custom reassignment JSON."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://kafka.apache.org/documentation/#replication",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.87,
  "fix_success_rate": 0.85,
  "resolvable": "true",
  "first_seen": "2023-08-01",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}