Skip to content

App crashes with Swift task continuation misuse during MCP connection handling #158

@KGN1337

Description

@KGN1337

iMCP crashes repeatedly during normal use. The crash is not a user-triggered quit or an OS-level termination — it's an internal Swift concurrency error triggered when Claude Desktop reconnects to the MCP server.

What happens:

iMCP starts, runs briefly, then disappears from the menu bar. Inspecting system logs reveals the crash occurs during a burst of incoming TCP connections from Claude Desktop. iMCP opens 20–30 connections in rapid succession, then begins cancelling earlier ones while still trying to set handlers on them — resulting in a fatal Swift error:

SWIFT TASK CONTINUATION MISUSE: connect() tried to resume its continuation 
more than once, throwing [-32603] Internal error: Connection cancelled!

Preceded by repeated warnings:

nw_connection_set_queue_block_invoke [Cx] Error in client: 
nw_connection_set_queue called after nw_connection_start

And:

SWIFT TASK CONTINUATION MISUSE: connect() leaked its continuation 
without resuming it. This may cause tasks waiting on it to remain 
suspended forever.

Pattern:
The crash happens consistently when Claude Desktop (re)connects — likely on startup or after iMCP has been idle. The app then auto-relaunches (via Login Items) and the cycle repeats.

Environment:

  • iMCP version: 1.4.0
  • macOS: Sequoia 15.x
  • Mac Mini M4
  • Claude Desktop connected as MCP client

Reproduction:
Launch iMCP, open Claude Desktop (or reconnect it). Observe iMCP disappearing from the menu bar within seconds to minutes.

Relevant log excerpt (anonymized):

iMCP[XXXX] [co.dododo.iMCP:server] Starting MCP server for connection: <private>
iMCP[XXXX] [co.dododo.iMCP:server] Connection <private> successfully established
...
[repeated ~25 times for connections C1–C27]
...
iMCP[XXXX] nw_connection_set_queue_block_invoke [C1] Error in client: 
  nw_connection_set_queue called after nw_connection_start
iMCP[XXXX] (libswiftCore.dylib) SWIFT TASK CONTINUATION MISUSE: 
  connect() leaked its continuation without resuming it.
...
iMCP[XXXX] (libswiftCore.dylib) Fatal error: SWIFT TASK CONTINUATION MISUSE: 
  connect() tried to resume its continuation more than once, 
  throwing [-32603] Internal error: Connection cancelled!

The app exits immediately after the fatal error, with no crash report generated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions