Useful or not, from you.
flutter Error connecting to the service protocol: failed to connect to http://127.0.0.1:1027/

Steps to Reproduce

I am trying to debug Firebase Dynamic Links and I cannot reproduce the issue with the Simulator, so I need to debug on a physical device. So from Visual Code, I choose my physical device and Start Debugging. Alas, it crashes during startup with:

Error connecting to the service protocol: failed to connect to http://127.0.0.1:1027/
Exited (sigterm)

What can I do?

<details> <summary>Logs</summary>

[✓] Flutter (Channel stable, v1.17.5, on Mac OS X 10.15.5 19F101, locale en-US)
    • Flutter version 1.17.5 at /Users/anthony/flutter
    • Framework revision 8af6b2f038 (3 days ago), 2020-06-30 12:53:55 -0700
    • Engine revision ee76268252
    • Dart version 2.8.4

 
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.0-rc4)
    • Android SDK at /Users/anthony/Library/Android/sdk
    • Platform android-R, build-tools 30.0.0-rc4
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.5, Build version 11E608c
    • CocoaPods version 1.9.3

[✓] Android Studio (version 4.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 46.0.2
    • Dart plugin version 193.7361
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] VS Code (version 1.46.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.12.1

[✓] Connected device (3 available)
    • Anthony's iPhone X    • dd69530247333fb75a3729579a8510e4c02268d4 • ios • iOS 13.5.1
    • iPhone 11 Pro Max     • 24F5F921-BD98-497F-9DEF-7F99FEDA41E1     • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-5 (simulator)
    • iPad (7th generation) • 9A327E6C-836E-497B-B174-86AD0B20D40E     • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-5 (simulator)

• No issues found!

</details>

That's a useful answer
Without any help

The whole output is too big with GitHub, but here is the tail:

[ +740 ms] [ 52%] CreatingStagingDirectory
[        ] [ 57%] ExtractingPackage
[        ] [ 60%] InspectingPackage
[  +28 ms] [ 60%] TakingInstallLock
[  +25 ms] [ 65%] PreflightingApplication
[+2292 ms] [ 65%] InstallingEmbeddedProfile
[  +22 ms] [ 70%] VerifyingApplication
[ +608 ms] [ 75%] CreatingContainer
[   +4 ms] [ 80%] InstallingApplication
[   +7 ms] [ 85%] PostflightingApplication
[   +5 ms] [ 90%] SandboxingApplication
[   +8 ms] [ 95%] GeneratingApplicationMap
[ +472 ms] [100%] Installed package build/ios/iphoneos/Runner.app
[ +201 ms] ------ Debug phase ------
[        ] Starting debug of dd65390247333fb75a3729579a8410e5c02268d4 (D22AP, iPhone X, iphoneos, arm64) a.k.a. 'Anthony's iPhone X' connected through USB...
[+1258 ms] [  0%] Looking up developer disk image
[  +24 ms] [ 95%] Developer disk image mounted successfully
[+1679 ms] [100%] Connecting to remote debug server
[        ] -------------------------
[ +232 ms] (lldb) command source -s 0 '/tmp/FF843104-4D58-4A16-AD6D-D5EF45BD8BA3/fruitstrap-lldb-prep-cmds-dd65390247333fb75a3729579a8410e5c02268d4'
[        ] Executing commands in '/tmp/FF843104-4D58-4A16-AD6D-D5EF45BD8BA3/fruitstrap-lldb-prep-cmds-dd65390247333fb75a3729579a8410e5c02268d4'.
[        ] (lldb)     platform select remote-ios --sysroot '/Users/anthony/Library/Developer/Xcode/iOS DeviceSupport/13.5.1 (17F80)/Symbols'
[        ]   Platform: remote-ios
[        ]  Connected: no
[        ]   SDK Path: "/Users/anthony/Library/Developer/Xcode/iOS DeviceSupport/13.5.1 (17F80)/Symbols"
[        ] (lldb)     target create "/Users/anthony/github/kozzet/kozzeted/build/ios/iphoneos/Runner.app"
[+8395 ms] Current executable set to '/Users/anthony/github/kozzet/kozzeted/build/ios/iphoneos/Runner.app' (arm64).
[        ] (lldb)     script fruitstrap_device_app="/private/var/containers/Bundle/Application/027F0205-6813-40A3-BDF6-6B4BDE9AB15A/Runner.app"
[   +2 ms] (lldb)     script fruitstrap_connect_url="connect://127.0.0.1:49781"
[        ] (lldb)     script fruitstrap_output_path=""
[        ] (lldb)     script fruitstrap_error_path=""
[        ] (lldb)     target modules search-paths add /usr "/Users/anthony/Library/Developer/Xcode/iOS DeviceSupport/13.5.1 (17F80)/Symbols/usr" /System "/Users/anthony/Library/Developer/Xcode/iOS DeviceSupport/13.5.1 (17F80)/Symbols/System" "/private/var/containers/Bundle/Application/027F0205-6813-40A3-BDF6-6B4BDE9AB15A" "/Users/anthony/github/kozzet/kozzeted/build/ios/iphoneos" "/var/containers/Bundle/Application/027F0205-6813-40A3-BDF6-6B4BDE9AB15A" "/Users/anthony/github/kozzet/kozzeted/build/ios/iphoneos" /Developer "/Users/anthony/Library/Developer/Xcode/iOS DeviceSupport/13.5.1 (17F80)/Symbols/Developer"
[  +43 ms] (lldb)     command script import "/tmp/FF843104-4D58-4A16-AD6D-D5EF45BD8BA3/fruitstrap_dd65390247333fb75a3729579a8410e5c02268d4.py"
[   +5 ms] (lldb)     command script add -f fruitstrap_dd65390247333fb75a3729579a8410e5c02268d4.connect_command connect
[        ] (lldb)     command script add -s asynchronous -f fruitstrap_dd65390247333fb75a3729579a8410e5c02268d4.run_command run
[        ] (lldb)     safequit
[ +183 ms] Application launched on the device. Waiting for observatory port.
[   +8 ms] Attempting to forward device port 58534 to host port 1024
[        ] executing: /Users/anthony/flutter/bin/cache/artifacts/usbmuxd/iproxy 1024 58534 dd65390247333fb75a3729579a8410e5c02268d4
[  +17 ms] Attempting to forward device port 58534 to host port 1025
[        ] executing: /Users/anthony/flutter/bin/cache/artifacts/usbmuxd/iproxy 1025 58534 dd65390247333fb75a3729579a8410e5c02268d4
[  +14 ms] Attempting to forward device port 58534 to host port 1026
[        ] executing: /Users/anthony/flutter/bin/cache/artifacts/usbmuxd/iproxy 1026 58534 dd65390247333fb75a3729579a8410e5c02268d4
[  +16 ms] Attempting to forward device port 58534 to host port 1027
[        ] executing: /Users/anthony/flutter/bin/cache/artifacts/usbmuxd/iproxy 1027 58534 dd65390247333fb75a3729579a8410e5c02268d4
[  +15 ms] Attempting to forward device port 58534 to host port 1028
[        ] executing: /Users/anthony/flutter/bin/cache/artifacts/usbmuxd/iproxy 1028 58534 dd65390247333fb75a3729579a8410e5c02268d4
[  +15 ms] Attempting to forward device port 58534 to host port 1029
[        ] executing: /Users/anthony/flutter/bin/cache/artifacts/usbmuxd/iproxy 1029 58534 dd65390247333fb75a3729579a8410e5c02268d4
[  +15 ms] Attempting to forward device port 58534 to host port 1030
[        ] executing: /Users/anthony/flutter/bin/cache/artifacts/usbmuxd/iproxy 1030 58534 dd65390247333fb75a3729579a8410e5c02268d4
[+1008 ms] Forwarded port ForwardedPort HOST:1030 to DEVICE:58534
[ +123 ms] HttpException: , uri = http://localhost:1030/ws
[+2200 ms] HttpException: , uri = http://localhost:1030/ws
[+2128 ms] HttpException: , uri = http://localhost:1030/ws
[+2129 ms] HttpException: , uri = http://localhost:1030/ws
[+2295 ms] HttpException: , uri = http://localhost:1030/ws
[+2003 ms] Failed to connect directly, falling back to mDNS
[   +4 ms] Checking for advertised Dart observatories...
[+5023 ms] Checking for available port on com.kozzet.kozzeted._dartobservatory._tcp.local
[   +1 ms] Checking for authentication code for com.kozzet.kozzeted._dartobservatory._tcp.local
[   +3 ms] Attempting to forward device port 58534 to host port 1024
[        ] executing: /Users/anthony/flutter/bin/cache/artifacts/usbmuxd/iproxy 1024 58534 dd65390247333fb75a3729579a8410e5c02268d4
[  +18 ms] Attempting to forward device port 58534 to host port 1025
[        ] executing: /Users/anthony/flutter/bin/cache/artifacts/usbmuxd/iproxy 1025 58534 dd65390247333fb75a3729579a8410e5c02268d4
[  +15 ms] Attempting to forward device port 58534 to host port 1026
[        ] executing: /Users/anthony/flutter/bin/cache/artifacts/usbmuxd/iproxy 1026 58534 dd65390247333fb75a3729579a8410e5c02268d4
[  +14 ms] Attempting to forward device port 58534 to host port 1027
[        ] executing: /Users/anthony/flutter/bin/cache/artifacts/usbmuxd/iproxy 1027 58534 dd65390247333fb75a3729579a8410e5c02268d4
[  +14 ms] Attempting to forward device port 58534 to host port 1028
[        ] executing: /Users/anthony/flutter/bin/cache/artifacts/usbmuxd/iproxy 1028 58534 dd65390247333fb75a3729579a8410e5c02268d4
[  +14 ms] Attempting to forward device port 58534 to host port 1029
[        ] executing: /Users/anthony/flutter/bin/cache/artifacts/usbmuxd/iproxy 1029 58534 dd65390247333fb75a3729579a8410e5c02268d4
[  +14 ms] Attempting to forward device port 58534 to host port 1030
[        ] executing: /Users/anthony/flutter/bin/cache/artifacts/usbmuxd/iproxy 1030 58534 dd65390247333fb75a3729579a8410e5c02268d4
[  +14 ms] Attempting to forward device port 58534 to host port 1031
[        ] executing: /Users/anthony/flutter/bin/cache/artifacts/usbmuxd/iproxy 1031 58534 dd65390247333fb75a3729579a8410e5c02268d4
[+1007 ms] Forwarded port ForwardedPort HOST:1031 to DEVICE:58534
[   +2 ms] Installing and launching... (completed in 53.8s)
[   +8 ms] Connecting to service protocol: http://127.0.0.1:1031/
[ +154 ms] Fail to connect to service protocol: http://127.0.0.1:1031/: HttpException: , uri = http://127.0.0.1:1031/ws
[        ] Error connecting to the service protocol: failed to connect to http://127.0.0.1:1031/
Exited (sigterm)