Skip to content

Hot reload claims that a stream is already listened to #290

@gspencergoog

Description

@gspencergoog

Description

The issue is that when an app is already started and connected via connect_dart_tooling_daemon and a hot_reload is called, the following exception occurs:

MCP tool 'hot_reload' reported tool error for function call:
{"name":"hot_reload","args":{}} with response:
[{"functionResponse":{"name":"hot_reload","response":{"error":{"content":[{"type":"text",
"text":"streamListen: (103) Stream already subscribed\n#0      new _OutstandingRequest
(package:vm_service/src/vm_service.dart:278)\n#1      VmService._call.<anonymous closure>
(package:vm_service/src/vm_service.dart:1960)\n#2      VmService._call
(package:vm_service/src/vm_service.dart:1972)\n#3      VmService.streamListen
(package:vm_service/src/vm_service.dart:1888)\n#4
DartToolingDaemonSupport.hotReload.<anonymous closure>
(package:dart_mcp_server/src/mixins/dtd.dart:382)\n<asynchronous suspension>\n#5
DartToolingDaemonSupport._callOnVmService
(package:dart_mcp_server/src/mixins/dtd.dart:635)\n<asynchronous suspension>\n#6
DartMCPServer.registerTool.<anonymous closure>
(package:dart_mcp_server/src/server.dart:191)\n<asynchronous suspension>\n#7
ToolsSupport._callTool
(package:dart_mcp/src/server/tools_support.dart:113)\n<asynchronous suspension>\n#8
Server._handleSingleRequest (package:json_rpc_2/src/server.dart:212)\n<asynchronous
suspension>\n#9      Server._handleRequest
(package:json_rpc_2/src/server.dart:187)\n<asynchronous
suspension>\n"}],"isError":true}}}}]   

This happens on (at least) linux and macos targets.

This happens because the hotReload function is trying to create a temporary listener to the system stream, but the app listener already has one open.

Metadata

Metadata

Assignees

Labels

P1A high priority bug; for example, a single project is unusable or has many test failurespackage:dart_mcp_servertype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions