Repository navigation
Unable to select devices or start debugging Flutter apps when with certain builds of "git" on PATH (msys2, devkitpro) #4840
Copy link
Copy link
Open
Labels
blocked on dart / flutterRequires a change in Dart or Flutter to progressRequires a change in Dart or Flutter to progressin flutterRelates to running Flutter appsRelates to running Flutter appsis bug
Milestone
Description
Describe the bug
I can't debug my Flutter app using VSCode anymore. When I start VSCode, it shows 'No Device' in the bottom right corner and interacting with it does not give me any options for devices. Trying to run a debug session with F5 or by clicking 'Run and debug' creates a loop and the debugger never starts.
To Reproduce
I am unable to reproduce it since it is still occurring.
Workspace
- Operating System and version: "Windows 10 Pro" 10.0 (Build 22631)
- VS Code version: win 1.84.2
- Dart extension version: 3.76.1
- Flutter extension version: 3.76.0
- Dart/Flutter SDK version: Dart (3.1.5) / Flutter (3.13.9)
Steps I Tried to Solve the Problem
- Initializing the app through 'flutter run' (it works; the terminal gives me the correct options for available devices, but – as far as I know, at least – you can't do a step-by-step debug from it, only through IDEs).
- Running 'flutter doctor' (everything is okay)
- Creating a new project and attempting to debug it.
- Disabling and, also, uninstalling all my extensions (leaving only Dart and Flutter extensions).
- Uninstalling VSCode (and reinstalling after a reboot).
- Uninstalling Flutter/Dart (and reinstalling after a reboot).
- Uninstalling both VSCode and Flutter/Dart (and reinstalling after a reboot), also completely cleaning any residual files before reinstalling too.
- Rolling back extensions to an older version (that I had used before).
- Deleting and rebuilding the launch.json file (by using VSCode's default option to create a launch.json file).
- Deleting my entire project and cloning it again using Git in another directory.
- Creating a new project in another directory.
LOG flutter doctor -v
PS C:\Users\PcUser\Documents\Projects\FlutterApp> flutter doctor -v
[√] Flutter (Channel stable, 3.13.9, on Microsoft Windows [versÆo 10.0.22631.2506], locale pt-BR)
• Flutter version 3.13.9 on channel stable at C:\Flutter\flutter
• Upstream repository unknown source
• FLUTTER_GIT_URL = unknown source
• Framework revision d211f42860 (3 weeks ago), 2023-10-25 13:42:25 -0700
• Engine revision 0545f8705d
• Dart version 3.1.5
• DevTools version 2.25.0
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at C:\Users\PcUser\AppData\Local\Android\Sdk
• Platform android-34, build-tools 34.0.0
• ANDROID_HOME = C:\Users\PcUser\AppData\Local\Android\Sdk
• Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
• Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-9586694)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.6.3)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.6.33801.468
• Windows 10 SDK version 10.0.22000.0
[√] Android Studio (version 2022.2)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-9586694)
[√] VS Code (version 1.84.2)
• VS Code at C:\Users\PcUser\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.70.0
[√] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [versÆo 10.0.22631.2506]
• Chrome (web) • chrome • web-javascript • Google Chrome 119.0.6045.124
• Edge (web) • edge • web-javascript • Microsoft Edge 119.0.2151.58
[√] Network resources
• All expected network resources are available.
• No issues found!
Edit: The 'Returning cached promise for getSupportedPlatforms()' lines are me clicking the 'No Device' button in the bottom right corner of VSCode. After that I try running the debugger with F5 and then by clicking 'Run and Debug'
Dart Capture LOG 1 (About a minute) - Older versions of extensions
Dart Code extension: 3.70.0
Flutter extension: 3.70.0 (activated)
App: Visual Studio Code
Version: 1.84.2
Platform: win
Workspace type: Flutter
Analyzer type: LSP
Multi-root?: false
Dart SDK:
Loc: C:\Flutter\flutter\bin\cache\dart-sdk
Ver: 3.1.5
Flutter SDK:
Loc: C:\Flutter\flutter
Ver: 3.13.9
HTTP_PROXY: undefined
NO_PROXY: undefined
Logging Categories:
General, CommandProcesses, DartTest, DAP, VmService, DevTools, FlutterDaemon, FlutterRun, FlutterTest, WebDaemon
Wed Nov 15 2023 Log file started
[8:51:48 AM] [General] [Info] Returning cached results for project search
[8:51:50 AM] [General] [Info] Returning cached results for project search
[8:51:50 AM] [General] [Info] Checking 1 projects for supported platforms
[8:51:50 AM] [FlutterDaemon] [Info] ==> [{"id":"3","method":"daemon.getSupportedPlatforms","params":{"projectRoot":"C:\\Users\\PcUser\\Documents\\Projects\\FlutterApp"}}]
[8:51:50 AM] [General] [Info] Returning cached promise for getSupportedPlatforms()
[8:51:51 AM] [General] [Info] Returning cached promise for getSupportedPlatforms()
[8:51:51 AM] [General] [Info] Returning cached promise for getSupportedPlatforms()
[8:51:51 AM] [General] [Info] Returning cached promise for getSupportedPlatforms()
[8:51:51 AM] [General] [Info] Returning cached promise for getSupportedPlatforms()
[8:51:51 AM] [General] [Info] Returning cached promise for getSupportedPlatforms()
[8:51:52 AM] [General] [Info] Returning cached promise for getSupportedPlatforms()
[8:51:52 AM] [General] [Info] Returning cached promise for getSupportedPlatforms()
[8:51:53 AM] [General] [Info] Returning cached promise for getSupportedPlatforms()
[8:51:54 AM] [General] [Info] Returning cached promise for getSupportedPlatforms()
[8:51:55 AM] [General] [Info] Returning cached promise for getSupportedPlatforms()
[8:51:56 AM] [General] [Info] Returning cached promise for getSupportedPlatforms()
[8:51:57 AM] [General] [Info] Returning cached promise for getSupportedPlatforms()
[8:52:04 AM] [General] [Info] Starting debug session...
[8:52:04 AM] [General] [Info] workspace: C:\\Users\\PcUser\\Documents\\Projects\\FlutterApp
[8:52:04 AM] [General] [Info] Setting cwd based on likely entry point: C:\\Users\\<PcUser>\\Documents\\<Projects>\\<FlutterApp>
[8:52:04 AM] [General] [Info] Using open file as entry point: C:\\Users\\PcUser\\Documents\\Projects\\FlutterApp\\lib\\main.dart
[8:52:04 AM] [General] [Info] Using workspace as cwd: C:\\Users\\<PcUser>\\Documents\\<Projects>\\<FlutterApp>
[8:52:04 AM] [General] [Info] Detected launch project as Flutter
[8:52:04 AM] [General] [Info] Using Flutter debug adapter for this session
[8:52:04 AM] [FlutterDaemon] [Info] ==> [{"id":"4","method":"daemon.getSupportedPlatforms","params":{"projectRoot":"C:\\Users\\PcUser\\Documents\\Projects\\FlutterApp"}}]
[8:52:09 AM] [General] [Info] Returning cached promise for getSupportedPlatforms()
Wed Nov 15 2023 Log file ended
Dart Capture LOG 2 (About a minute) - Latest versions of extensions
Dart Code extension: 3.76.1
Flutter extension: 3.76.0 (activated)
App: Visual Studio Code
App Host: desktop
Version: win 1.84.2
Workspace type: Flutter (LSP)
Dart (3.1.5): C:\Flutter\flutter\bin\cache\dart-sdk
Flutter (3.13.9): C:\Flutter\flutter (No device)
Logging Categories:
General, CommandProcesses, DartTest, DAP, VmService, DevTools, FlutterDaemon, FlutterRun, FlutterTest, WebDaemon
Wed Nov 15 2023 [09:01:57 GMT-0300 (Brasilia Standard Time)] Log file started
[9:02:00 AM] [General] [Info] Returning cached results for project search
[9:02:00 AM] [General] [Info] Checking 1 projects for supported platforms
[9:02:00 AM] [FlutterDaemon] [Info] ==> [{"id":"3","method":"daemon.getSupportedPlatforms","params":{"projectRoot":"C:\\Users\\PcUser\\Documents\\Projects\\FlutterApp"}}]
[9:02:05 AM] [General] [Info] Returning cached promise for getSupportedPlatforms()
[9:02:09 AM] [General] [Info] Returning cached promise for getSupportedPlatforms()
[9:02:11 AM] [General] [Info] Returning cached promise for getSupportedPlatforms()
[9:02:14 AM] [General] [Info] Starting debug session...
[9:02:14 AM] [General] [Info] workspace: C:\Users\PcUser\Documents\Projects\FlutterApp
[9:02:14 AM] [General] [Info] Setting cwd based on likely entry point: C:\Users\PcUser\Documents\Projects\FlutterApp
[9:02:14 AM] [General] [Info] Using open file as entry point: C:\Users\PcUser\Documents\Projects\FlutterApp\lib\main.dart
[9:02:14 AM] [General] [Info] Using workspace as cwd: C:\Users\PcUser\Documents\Projects\FlutterApp
[9:02:14 AM] [General] [Info] Detected launch project as Flutter
[9:02:14 AM] [General] [Info] Using Flutter debug adapter for this session
[9:02:14 AM] [FlutterDaemon] [Info] ==> [{"id":"4","method":"daemon.getSupportedPlatforms","params":{"projectRoot":"C:\\Users\\PcUser\\Documents\\Projects\\FlutterApp"}}]
[9:02:19 AM] [General] [Info] Returning cached promise for getSupportedPlatforms()
[9:02:34 AM] [General] [Info] Starting debug session...
[9:02:34 AM] [General] [Info] workspace: C:\Users\PcUser\Documents\Projects\FlutterApp
[9:02:34 AM] [General] [Info] Setting cwd based on likely entry point: C:\Users\PcUser\Documents\Projects\FlutterApp
[9:02:34 AM] [General] [Info] Using open file as entry point: C:\Users\PcUser\Documents\Projects\FlutterApp\lib\main.dart
[9:02:34 AM] [General] [Info] Using workspace as cwd: C:\Users\PcUser\Documents\Projects\FlutterApp
[9:02:34 AM] [General] [Info] Detected launch project as Flutter
[9:02:34 AM] [General] [Info] Using Flutter debug adapter for this session
[9:02:34 AM] [FlutterDaemon] [Info] ==> [{"id":"5","method":"daemon.getSupportedPlatforms","params":{"projectRoot":"C:\\Users\\PcUser\\Documents\\Projects\\FlutterApp"}}]
[9:02:39 AM] [General] [Info] Returning cached promise for getSupportedPlatforms()
Wed Nov 15 2023 [09:03:31 GMT-0300 (Brasilia Standard Time)] Log file ended
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
blocked on dart / flutterRequires a change in Dart or Flutter to progressRequires a change in Dart or Flutter to progressin flutterRelates to running Flutter appsRelates to running Flutter appsis bug
Activity
DanTup commentedon Nov 15, 2023
Can you enable the Flutter Daemon log (https://dartcode.org/docs/logging/#flutter-daemon) and provide the full log when this occurs?
The logs you posted are missing the startup of the daemon (and the exact command/env being used). My guess is that there are some bad arguments or env variables (possibly as a result of the fix in f490caf) being set when spawning the daemon that's causing it not to work properly.
GusBovo commentedon Nov 15, 2023
As requested:
Flutter Daemon Log
Also, another log from >Dart: Capture Log, if needed:
Capture Log
DanTup commentedon Nov 16, 2023
Can you try the following:
C:\Flutter\flutter\bin\flutter.bat daemon -v[{"id":"1","method":"device.enable"}]and press<enter>Thanks!
GusBovo commentedon Nov 16, 2023
Here is the output:
GusBovo commentedon Nov 16, 2023
I am sorry, missed half of it while copying. Here is the rest of it:
DanTup commentedon Nov 21, 2023
Sorry for the delay. In the most recent log you posted, there are some devices registered, so I guess the question is why this is different when you run from the terminal compared to when VS Code runs.
Could you try this:
flutter doctor -vfrom the terminal (where the devices show up), and post both of them here."dart.flutterAdditionalArgs": [ "-v" ],to your VS Code user or workspace settings and capture the same daemon log noted above (Unable to select devices or start debugging Flutter apps when with certain builds of "git" on PATH (msys2, devkitpro) #4840 (comment)), which this time should be more verboseThanks!
GusBovo commentedon Nov 21, 2023
Hello again! I am sending the logs as requested.
Since I changed
"dart.flutterAdditionalArgs": [ "-v" ],before running '> Flutter: Run Flutter Doctor', it seems like it also got more verbose, hopefully it helps.'> Flutter: Run Flutter Doctor log'
Details
GusBovo commentedon Nov 21, 2023
Terminal Flutter Doctor -v log
GusBovo commentedon Nov 21, 2023
Daemon log with additional args
DanTup commentedon Nov 22, 2023
Hmm, this is odd - everything looks identical to me in the logs, but the devices are not showing up when the process was spawned by VS Code.
The only remaining thing I see different (besides potential env variables), is the working directory. Is it possible you can try the instructions from before (to run the daemon manually in the terminal in the same way that VS Code does) but in the same directory (the Flutter SDK) that VS Code is using? I don't expect the working directory makes a difference, but it's a variable worth eliminating.
Can you try the following:
cd C:\Flutter\flutter(new step)C:\Flutter\flutter\bin\flutter.bat daemon -v[{"id":"1","method":"device.enable"}]and press<enter>@christopherfujino FYI in case you have any ideas. The device daemon is not returning any devices when run from VS Code (but does from the terminal). The output of
flutter doctoris the same in both cases (eg. Visual Studio etc. are all detected). From the terminal, Chrome, Windows, Edge all show up - but for VS Code, none of them do.GusBovo commentedon Nov 22, 2023
I've checked my environment variables, and flutter seems to be correctly set.
What I have just now noticed is that – after you pointed out which devices are actually showing in the logs – it should also display a Pixel 3a emulated device that I set up for this machine. I also checked to make sure there are no issues with the Android SDK environment variables, and they seem fine too.
Here is the log as requested:
Terminal log
DanTup commentedon Nov 22, 2023
There may be two issues here then. From the logs before, I see the desktop/web devices showing up when you're running the daemon from the terminal, but they're not in VS Code's logs. Those things should be the same.
If the physical Android device isn't showing up in either list, then that's a different issue and probably worth filing another issue for (in flutter/flutter), although I would first check you have Developer Mode and USB Debugging enabled (for some reason on my device I have to re-enable USB Debugging on every boot of the device) and try different cables.
It's also worth noting that there has been a new stable release of Flutter since you first posted here (3.16). I would also suggest upgrading to that and see if it changes anything - there are lots of fixes in that release and it's just possible that you're hitting something that has been fixed.
GusBovo commentedon Nov 23, 2023
Unfortunately, updating Flutter didn't solve the problem. I could send more logs, but the behavior seems to be the same.
About the Android device: I might have phrased it incorrectly, as English is not my main language. What I meant to say is that I have a virtual device (an emulator from Android Studio) of a Pixel 3a, and it should also be visible alongside Windows, Chrome, and Edge (or at least, I believe it should). However, as you already pointed out, this is not the case.
If I can help in any other way, I am available. However, I am sincerely considering reinstalling the OS during the weekend, which I believe would be a more definite solution, as it seems like some weird bug is affecting the functionality of Flutter in the system as a whole.
105 remaining items
DanTup commentedon May 21, 2024
I also created a repro for this issue here:
https://github.com/DanTup/repro-dart-code-4840
You can replace
C:\Dev\Tools\msys64\usr\bin\cal.exeinfake_flutter.batwith a path togit.exeand runnode ./daemon_client_run_me.jsto test whether the issue is occurring or not.A full daemon log is the best way to verify the issue (or as @falsidge suggests, hard-code the full path to Git in
flutter.bat).[-]Unable to select devices or start debugging Flutter apps[/-][+]Unable to select devices or start debugging Flutter apps when with certain builds of "git" on PATH (msys2, devkitpro)[/+]tejasraman commentedon Jul 8, 2024
For me installing a Windows version of Git (from git scm) was enough to make the Flutter daemon work correctly - it seems to override MSYS git in the Windows PATH
edenbay commentedon Nov 12, 2024
I'm not sure which of it did it, but I moved git scm above MSYS, also uninstalled MSYS. Either way Dart now recognizes my devices and emulators.
MalindiJohn commentedon Apr 30, 2025
Experienced the same issue.
I fixed it by updating Android SDK tools via android studio and everything worked for me.
Not sure if this can fix your issue but you can try.
theo-magne-act commentedon Nov 12, 2025
Experienced the same issue using https://github.com/andy-5/wslgit. Installing standard git for windows solved it.