{
  "id": "api/graphql-subscription-connection-init-timeout",
  "signature": "GraphQL subscription error: Connection initialization timed out. No GQL_CONNECTION_INIT message received.",
  "signature_zh": "GraphQL 订阅错误：连接初始化超时。未收到 GQL_CONNECTION_INIT 消息。",
  "regex": "Connection initialization timed out|GQL_CONNECTION_INIT.*not received|subscription.*timeout",
  "domain": "api",
  "category": "protocol_error",
  "subcategory": null,
  "root_cause": "WebSocket connection for GraphQL subscriptions was established but the client did not send the required GQL_CONNECTION_INIT message within the server's timeout window (typically 10-30 seconds).",
  "root_cause_type": "generic",
  "root_cause_zh": "GraphQL 订阅的 WebSocket 连接已建立，但客户端未在服务器的超时窗口内（通常为 10-30 秒）发送必需的 GQL_CONNECTION_INIT 消息。",
  "versions": [
    {
      "version": "graphql-ws 5.14",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "subscriptions-transport-ws 0.11",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Apollo Server 4.10",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "HotChocolate 13.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "A longer timeout masks the real issue (missing init message) and may cause resource leaks from stale connections; the client should send init promptly.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Reconnection does not fix the missing init message; the same error will recur unless the client code is fixed to send GQL_CONNECTION_INIT.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Ensure the GraphQL client sends the GQL_CONNECTION_INIT message immediately after the WebSocket connection opens. In Apollo Client, this is automatic, but if using a custom WebSocket, send it in the 'open' event handler.",
      "success_rate": 0.95,
      "how": "Ensure the GraphQL client sends the GQL_CONNECTION_INIT message immediately after the WebSocket connection opens. In Apollo Client, this is automatic, but if using a custom WebSocket, send it in the 'open' event handler.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use a library that handles the handshake automatically, such as graphql-ws client or Apollo Client's subscription support, instead of raw WebSocket.",
      "success_rate": 0.9,
      "how": "Use a library that handles the handshake automatically, such as graphql-ws client or Apollo Client's subscription support, instead of raw WebSocket.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "确保 GraphQL 客户端在 WebSocket 连接打开后立即发送 GQL_CONNECTION_INIT 消息。在 Apollo Client 中这是自动的，但如果使用自定义 WebSocket，请在 'open' 事件处理程序中发送。",
    "使用自动处理握手的库，例如 graphql-ws 客户端或 Apollo Client 的订阅支持，而不是原始 WebSocket。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://github.com/enisdenjo/graphql-ws/blob/master/PROTOCOL.md",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.84,
  "fix_success_rate": 0.87,
  "resolvable": "true",
  "first_seen": "2024-04-22",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}