{
  "id": "communication/amqp-connection-closed-by-server",
  "signature": "AMQPConnectionError: connection closed by server (405) UNEXPECTED_FRAME",
  "signature_zh": "AMQPConnectionError: 服务器关闭连接 (405) UNEXPECTED_FRAME",
  "regex": "connection closed by server.*405|UNEXPECTED_FRAME",
  "domain": "communication",
  "category": "protocol_error",
  "subcategory": null,
  "root_cause": "RabbitMQ or other AMQP broker closes the connection when a client sends a frame out of order, such as a basic.publish without a channel.open, or a heartbeat after connection.tune-ok.",
  "root_cause_type": "generic",
  "root_cause_zh": "RabbitMQ或其他AMQP代理在客户端发送无序帧时关闭连接，例如在没有channel.open的情况下发送basic.publish，或在connection.tune-ok之后发送心跳。",
  "versions": [
    {
      "version": "AMQP 0-9-1",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "RabbitMQ 3.12",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Pika 1.3",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Restart the RabbitMQ server to clear the error",
      "why_fails": "The error is client-side; restarting the broker does not fix the client's frame ordering issue",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "Increase the heartbeat interval on the client",
      "why_fails": "Heartbeat timing is not the cause; the client is sending frames without proper channel initialization",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    },
    {
      "action": "Use a different AMQP library (e.g., switch from Pika to Kombu)",
      "why_fails": "The error is protocol-level, not library-specific; a different library will fail the same way if the frame sequence is wrong",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Ensure the client opens a channel before publishing. In Pika, call channel = connection.channel() before any basic_publish. Verify the channel is not None and is open.",
      "success_rate": 0.9,
      "how": "Ensure the client opens a channel before publishing. In Pika, call channel = connection.channel() before any basic_publish. Verify the channel is not None and is open.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Check for multiple threads sharing the same connection without synchronization. Use a connection per thread or add a lock around channel operations.",
      "success_rate": 0.8,
      "how": "Check for multiple threads sharing the same connection without synchronization. Use a connection per thread or add a lock around channel operations.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Ensure the client opens a channel before publishing. In Pika, call channel = connection.channel() before any basic_publish. Verify the channel is not None and is open.",
    "Check for multiple threads sharing the same connection without synchronization. Use a connection per thread or add a lock around channel operations."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://www.rabbitmq.com/amqp-0-9-1-reference.html#connection.close",
  "official_doc_section": null,
  "error_code": "405",
  "verification_tier": "ai_generated",
  "confidence": 0.87,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-04-20",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}