{
  "id": "flutter/isolate-send-port-closed",
  "signature": "Unhandled exception: IsolateSpawnException: Failed to send message: SendPort is already closed",
  "signature_zh": "未处理的异常：IsolateSpawnException：无法发送消息：SendPort 已关闭",
  "regex": "IsolateSpawnException: Failed to send message: SendPort is already closed",
  "domain": "flutter",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "An attempt was made to send a message via a SendPort that has been closed, typically because the receiving isolate has terminated or the port was disposed.",
  "root_cause_type": "generic",
  "root_cause_zh": "尝试通过已关闭的 SendPort 发送消息，通常是因为接收隔离已终止或端口已被释放。",
  "versions": [
    {
      "version": "Flutter 3.13.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Dart 3.1.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Increase the size of the isolate's message queue.",
      "why_fails": "The error is not about queue capacity but about the port being closed; queue size does not affect closed ports.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "Wrap the send call in a try-catch and ignore the error.",
      "why_fails": "Ignoring the error leads to silent data loss; the root cause (port closure) remains unaddressed.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Check if the receiving isolate is still alive before sending. Use a shared flag or a ping mechanism: if (receivePort.isClosed) { await spawnIsolate(); } then send.",
      "success_rate": 0.85,
      "how": "Check if the receiving isolate is still alive before sending. Use a shared flag or a ping mechanism: if (receivePort.isClosed) { await spawnIsolate(); } then send.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Implement a reconnection strategy: when the error occurs, close the old SendPort, spawn a new isolate, and recreate the port pair. Example: isolate = await Isolate.spawn(entryPoint, receivePort.sendPort); sendPort = isolate.controlPort;",
      "success_rate": 0.8,
      "how": "Implement a reconnection strategy: when the error occurs, close the old SendPort, spawn a new isolate, and recreate the port pair. Example: isolate = await Isolate.spawn(entryPoint, receivePort.sendPort); sendPort = isolate.controlPort;",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use a dedicated communication manager that monitors isolate lifecycle and automatically re-establishes ports on termination.",
      "success_rate": 0.75,
      "how": "Use a dedicated communication manager that monitors isolate lifecycle and automatically re-establishes ports on termination.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Check if the receiving isolate is still alive before sending. Use a shared flag or a ping mechanism: if (receivePort.isClosed) { await spawnIsolate(); } then send.",
    "Implement a reconnection strategy: when the error occurs, close the old SendPort, spawn a new isolate, and recreate the port pair. Example: isolate = await Isolate.spawn(entryPoint, receivePort.sendPort); sendPort = isolate.controlPort;",
    "Use a dedicated communication manager that monitors isolate lifecycle and automatically re-establishes ports on termination."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://api.dart.dev/stable/3.1.0/dart-isolate/Isolate-class.html",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.83,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-01-05",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}