)]}'
{
  "commit": "b5709995f0fe0ffe54c8d844932929c19fb00578",
  "tree": "b1d97e848f8e99f456e2a770f4f1894d5f1f6e28",
  "parents": [
    "dcb2cce79439796768e67474f710221f23d797ab"
  ],
  "author": {
    "name": "Ben Konyi",
    "email": "bkonyi@google.com",
    "time": "Fri Sep 04 16:25:00 2026 +0000"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Fri Sep 04 16:25:00 2026 +0000"
  },
  "message": "[flutter_tools] Fix unhandled DebugAdapterException on early process termination (#192294)\n\n## Description\n\nWhen a target application process exits prematurely (e.g. exit code 255)\nbefore the Debug Adapter Protocol (DAP) initialization handshake\ncompletes, `flutter_tools` crashed with an unhandled\n`DebugAdapterException` in the Dart Zone.\n\nIn Flutter 3.47.2 telemetry, this was the #3 top crasher with 203\ncrashes (`DebugAdapterException-34d39b25`).\n\n### Root Cause\n1. `FlutterBaseDebugAdapter.handleSessionTerminate` completed\n`debuggerInitializationFailedCompleter.completeError(...)` before\ncalling `super.handleSessionTerminate(...)`.\n2. In `package:dap_adapters` (`DartDebugAdapter`),\n`handleSessionTerminate` is asynchronous and awaits pending output\nevents before setting `isTerminating \u003d true`.\n3. In `FlutterDebugAdapter._handleAppStarted`, the unawaited\nasynchronous message handler caught the error while `isTerminating` was\nstill `false`, rethrowing `DebugAdapterException` into the Zone.\n\n### Fix\n1. Synchronously set `isTerminating \u003d true` in\n`FlutterBaseDebugAdapter.handleSessionTerminate`.\n2. In `FlutterDebugAdapter._handleAppStarted`, catch\n`DebugAdapterException` and send the message to console output rather\nthan rethrowing into the Zone.\n3. Clean up early termination message formatting when `exitSuffix` is\nprovided.\n\n## Related Issues\n* Fixes crasher `DebugAdapterException-34d39b25` in Flutter 3.47.1 and\n3.47.2 telemetry.\n\n## Tests\n* Added regression tests in\n`packages/flutter_tools/test/general.shard/dap/flutter_adapter_test.dart`\nand `flutter_test_adapter_test.dart` verifying that early process exit\noutputs cleanly to console and does not produce unhandled asynchronous\nexceptions.",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "034977c81dd9dc7c03f8f62468e951f904b8f5ed",
      "old_mode": 33188,
      "old_path": "packages/flutter_tools/lib/src/debug_adapters/flutter_adapter.dart",
      "new_id": "6ba1d71eee969c4786570ff10c671c5dd4510f06",
      "new_mode": 33188,
      "new_path": "packages/flutter_tools/lib/src/debug_adapters/flutter_adapter.dart"
    },
    {
      "type": "modify",
      "old_id": "b32e294458333ce72bcbc00487ac97f35b5a4064",
      "old_mode": 33188,
      "old_path": "packages/flutter_tools/lib/src/debug_adapters/flutter_base_adapter.dart",
      "new_id": "e3e1e324bb72ee6c94d5198a341ad7f59d283b9e",
      "new_mode": 33188,
      "new_path": "packages/flutter_tools/lib/src/debug_adapters/flutter_base_adapter.dart"
    },
    {
      "type": "modify",
      "old_id": "b26ee2e01392a8eb2b0065443bb01125f557190e",
      "old_mode": 33188,
      "old_path": "packages/flutter_tools/test/general.shard/dap/flutter_adapter_test.dart",
      "new_id": "acce5dd982bdf74bcbb718fb76b630f78837a03f",
      "new_mode": 33188,
      "new_path": "packages/flutter_tools/test/general.shard/dap/flutter_adapter_test.dart"
    },
    {
      "type": "modify",
      "old_id": "0f529f2c776d24e1e392f27e84e08fdfb690933f",
      "old_mode": 33188,
      "old_path": "packages/flutter_tools/test/general.shard/dap/flutter_test_adapter_test.dart",
      "new_id": "80ac6f933a7a41fe2d3693cc93e3279a7b1561f0",
      "new_mode": 33188,
      "new_path": "packages/flutter_tools/test/general.shard/dap/flutter_test_adapter_test.dart"
    },
    {
      "type": "modify",
      "old_id": "c77c51c276716623aa5bf35ff0292d7b57e9e6e7",
      "old_mode": 33188,
      "old_path": "packages/flutter_tools/test/general.shard/dap/mocks.dart",
      "new_id": "8e3f4551a19ea8d9135e3376c1b6eecef7324544",
      "new_mode": 33188,
      "new_path": "packages/flutter_tools/test/general.shard/dap/mocks.dart"
    }
  ]
}
