{
  "id": "redis/err-protocol-bad-int",
  "signature": "ERR Protocol error: invalid bulk length",
  "signature_zh": "ERR 协议错误：无效的批量长度",
  "regex": "ERR Protocol error: invalid bulk length",
  "domain": "redis",
  "category": "protocol_error",
  "subcategory": null,
  "root_cause": "The Redis server received a malformed RESP (Redis Serialization Protocol) message with an invalid bulk string length, often due to a network corruption or a buggy client implementation.",
  "root_cause_type": "generic",
  "root_cause_zh": "Redis 服务器收到了格式错误的 RESP 协议消息，其中包含无效的批量字符串长度，通常由网络损坏或客户端实现错误导致。",
  "versions": [
    {
      "version": "Redis 6.2.6",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Redis 7.0.11",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "ioredis 5.3.2",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Jedis 4.3.1",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "The error is about incoming data, not outgoing buffers.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "TLS may add overhead but is not the cause of malformed bulk lengths.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Enable Redis connection pooling with health checks to automatically drop corrupted connections. Example in Node.js using ioredis: `const redis = new Redis({ maxRetriesPerRequest: 3, retryStrategy: (times) => Math.min(times * 50, 2000) });`",
      "success_rate": 0.8,
      "how": "Enable Redis connection pooling with health checks to automatically drop corrupted connections. Example in Node.js using ioredis: `const redis = new Redis({ maxRetriesPerRequest: 3, retryStrategy: (times) => Math.min(times * 50, 2000) });`",
      "condition": "",
      "sources": []
    },
    {
      "action": "Add a proxy or load balancer that validates RESP protocol before forwarding to Redis, such as using HAProxy with a custom TCP health check.",
      "success_rate": 0.7,
      "how": "Add a proxy or load balancer that validates RESP protocol before forwarding to Redis, such as using HAProxy with a custom TCP health check.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Upgrade the client library to the latest version that includes better RESP parsing. For Java Jedis: `jedis.close(); jedis = new Jedis(host, port);` after catching the error.",
      "success_rate": 0.85,
      "how": "Upgrade the client library to the latest version that includes better RESP parsing. For Java Jedis: `jedis.close(); jedis = new Jedis(host, port);` after catching the error.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Enable Redis connection pooling with health checks to automatically drop corrupted connections. Example in Node.js using ioredis: `const redis = new Redis({ maxRetriesPerRequest: 3, retryStrategy: (times) => Math.min(times * 50, 2000) });`",
    "Add a proxy or load balancer that validates RESP protocol before forwarding to Redis, such as using HAProxy with a custom TCP health check.",
    "Upgrade the client library to the latest version that includes better RESP parsing. For Java Jedis: `jedis.close(); jedis = new Jedis(host, port);` after catching the error."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://redis.io/docs/latest/develop/reference/protocol-spec/",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.88,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2023-06-20",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}