# NousResearch/hermes-agent · MCP shutdown 'Event loop is closed' RuntimeError during task cancellation

## Open now

- 0 issues, 2 PRs open on GitHub.
- PR #60032: fix(mcp): catch RuntimeError when cancelling tasks on a closed event loop
- PR #64114: fix(mcp): catch RuntimeError when canceling tasks during event loop close

Nearly all members concern a RuntimeError ('Event loop is closed') raised when MCP server tasks are cancelled or cleaned up during /exit, Ctrl+C, or shutdown. They include bug reports and several proposed changes, such as catching the error, moving cancel() into a try block, and draining or reaping parked tasks.

## TL;DR

- 15 member(s): 0 open issue(s), 3 closed issue(s), 2 open PR(s), 1 merged PR(s), 9 PR(s) closed without merging.
- A fix was merged to main in PR #74139. Verify it addresses your case.
- **Recommended:** read PR #74139 (and any competing PRs below) before filing. Confirm the merged change covers your symptom.

## Maintainer resolution verdict

- Internal-tracker verdict over this cluster's issue members: `partially_resolved` · deciding PR(s): `pr-74139`. This is distinct from the fix status above. Weigh it yourself.

## How this cluster was grouped

- Link evidence (`STRUCTURAL_PARTIAL`): some members are connected by structural evidence (shared changed files, or a closing/superseded reference); the rest are joined by an automated relevance judgement over their text.
- Members outside that structural core may belong to a different underlying problem.
- Pairwise link density `0.16`: the share of member pairs that carry a link, counting a structural link in full and a relevance-only link at 0.36. `1.00` means every pair is linked.

## Closed / duplicate issues

- #60197: \[Bug\] RuntimeError: Event loop is closed during /exit (MCPServerTask.shutdown)
- #66113: RuntimeError: Event loop is closed during MCP shutdown
- #66228: RuntimeError: Event loop is closed on Ctrl+C exit (MCP server shutdown race)

## Prior & competing PRs

- **#74139: fix(mcp): drain the MCP loop and retain parked startup tasks for clean shutdown**. merged to main · fix tier `verified`
  - maintainer direction: category `merged`
  - files: `contributors/emails/[redacted:email]`, `contributors/emails/[redacted:email]`, `scripts/release.py`, `tests/tools/test_mcp_initial_connect_shutdown.py`, `tests/tools/test_mcp_stability.py`, `tests/tools/test_mcp_tool.py`, `tools/mcp_tool.py`
- **#60032: fix(mcp): catch RuntimeError when cancelling tasks on a closed event loop**. open
  - maintainer direction: category `superseded_by_pr`; implication `superseded`; refs `#60032`, `#60104`, `#60380`, `#80955`
  - files: `tools/mcp_tool.py`
- **#60205: fix(mcp): catch RuntimeError when canceling tasks on closed event loop during /exit**. closed without merge
  - maintainer direction: category `duplicate_of`; implication `duplicate`; refs `#60032`, `#60197`
- **#60213: fix(mcp): move t.cancel() inside try block to prevent RuntimeError on exit (#60197)**. closed without merge
  - maintainer direction: category `duplicate_of`; implication `duplicate`; refs `#60032`, `#60205`, `#60104`, `#60197`
- **#60287: fix(mcp): move t.cancel() inside try block to prevent RuntimeError on /exit**. closed without merge
  - maintainer direction: category `duplicate_of`; implication `duplicate`; refs `#60032`, `#60213`, `#60197`
- **#61466: Fix MCP task cancellation after event loop shutdown**. closed without merge
  - maintainer direction: category `superseded_by_pr`; implication `superseded`; refs `#74139`, `#60197`
- **#64114: fix(mcp): catch RuntimeError when canceling tasks during event loop close**. open
  - maintainer direction: category `superseded_by_pr`; implication `superseded`; refs `9d6c5a920c7`
  - files: `.gitignore`, `tests/tools/test_mcp_tool.py`, `tools/mcp_tool.py`
- **#69420: fix(mcp): swallow RuntimeError when cancelling parked tasks on closed loop**. closed without merge
  - maintainer direction: category `merged_via`; implication `superseded`; refs `1f70ba6bca71caa2c440607b06b74e596969e1b1`, `#74139`, `#60032`
- **#71846: fix(mcp): catch RuntimeError in _wait_for_reconnect_or_shutdown cleanup**. closed without merge
  - maintainer direction: category `implemented_elsewhere`; implication `superseded`; refs `1f70ba6bca71caa2c440607b06b74e596969e1b1`, `#74139`
- **#72054: fix(mcp): reap orphaned parked server task in _connect_server**. closed without merge
  - maintainer direction: category `implemented_elsewhere`; implication `superseded`; refs `#74139`, `#62026`
- **#73190: fix(mcp): catch RuntimeError when cancelling tasks during /exit (#60197)**. closed without merge
  - maintainer direction: category `duplicate_of`; implication `duplicate`; refs `#60032`
- **#73765: fix(mcp): suppress 'Event loop is closed' during shutdown race**. closed without merge
  - maintainer direction: category `superseded_by_pr`; implication `superseded`; refs `#74139`, `#60197`

## Fix status

- Merged to main in PR #74139 (cited above). No release data is tracked. Verify downstream.
- Fix last verified (merged) `2026-07-29`.
- Subsystem: `mcp`
