i keep on having this problem : Your launch config references a program that does not exist. If you have problems launching, check the "program" field in your ".vscode/launch.json" file.
Can you try:
Thanks!
Hello,
Thanks for the quick response, but i dont really understand what you mean
by- capture logs . I am very new to dart , i dont know much.
On Sat, Apr 18, 2020 at 9:19 PM Danny Tuppeny notifications@github.com
wrote:
Can you try:
- Run the Dart: Capture Logs command (untick Analysis Server, but
leave everything else ticked)- Try to run your app
- Click Cancel on the logging prompt to stop logging and open the
log file- Attach the log file here (make sure there's nothing sensitive in it
first)Thanks!
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/Dart-Code/Dart-Code/issues/2365#issuecomment-615879242,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AOXXRW5YEHCWJG75BFEF2PTRNGZF5ANCNFSM4MLLZCBA
.
Sorry, I should've been clearer! :-)
This will start capturing logs from the extension (a notification will be shown in the bottom right corner that they're being captured).
Let me know if anything isn't clear. Thanks!
Good day ,
Thanks once again for the reply ,. this is what i got
!! PLEASE REVIEW THIS LOG FOR SENSITIVE INFORMATION BEFORE SHARING !!
Dart Code extension: 3.9.1
Flutter extension: 3.9.1 (not activated)
VS Code: 1.44.2
Platform: win
Workspace type: Flutter
Multi-root?: false
Dart SDK:
Loc: C:\flutter\bin\cache\dart-sdk
Ver: 2.7.2
Flutter SDK:
Loc: C:\flutter
Ver: 1.12.13+hotfix.9
HTTP_PROXY: undefined
NO_PROXY: undefined
Sun Apr 19 2020 [14:05:24 GMT+0700 (Krasnoyarsk Standard Time)] Log file
started
[2:06:45 PM] [General] [Info] Starting debug session...
[2:06:45 PM] [General] [Info] workspace:
C:\Users\Ekundayo\Desktop\fredses_apk
[2:06:45 PM] [General] [Info] program : bin/main.dart
[2:06:45 PM] [General] [Info] Converted program to absolute path:
C:\Users\Ekundayo\Desktop\fredses_apk\bin\main.dart
[2:06:45 PM] [General] [Info] Using workspace as cwd:
C:\Users\Ekundayo\Desktop\fredses_apk
[2:06:45 PM] [General] [Warn] Launch config references non-existant file
C:\Users\Ekundayo\Desktop\fredses_apk\bin\main.dart
[2:06:45 PM] [General] [Info] Detected launch project as Dart
[2:06:45 PM] [General] [Info] Using Dart debug adapter for this session
[2:06:45 PM] [General] [Info] Checking for errors before launching
[2:06:45 PM] [General] [Info] Debug session starting...
{
"name": "Dart",
"program":
"C:\Users\Ekundayo\Desktop\fredses_apk\bin\main.dart",
"request": "launch",
"type": "dart",
"cwd": "C:\Users\Ekundayo\Desktop\fredses_apk",
"toolEnv": {
"FLUTTER_HOST": "VSCode",
"PUB_ENVIRONMENT": "vscode.dart-code"
},
"sendLogsToClient": true,
"globalFlutterArgs": [],
"args": [],
"vmAdditionalArgs": [],
"vmServicePort": 0,
"dartPath": "C:\flutter\bin\cache\dart-sdk\bin\dart.exe",
"maxLogLineLength": 2000,
"pubPath": "C:\flutter\bin\cache\dart-sdk\bin\pub.bat",
"pubSnapshotPath":
"C:\flutter\bin\cache\dart-sdk\bin\snapshots\pub.dart.snapshot",
"debugSdkLibraries": false,
"debugExternalLibraries": true,
"showDartDeveloperLogs": true,
"useFlutterStructuredErrors": true,
"debuggerHandlesPathsEverywhereForBreakpoints": true,
"evaluateGettersInDebugViews": true,
"previewToStringInDebugViews": false,
"useWriteServiceInfo": true,
"debugServer": 60045,
"debuggerType": 0
}
[2:06:46 PM] [Observatory] [Info] [Dart] Spawning
C:\flutter\bin\cache\dart-sdk\bin\dart.exe with args
["--enable-vm-service=0","--pause_isolates_on_start=true","--write-service-info=file:///C:/Users/Ekundayo/AppData/Local/Temp/dart-vm-service-566e.json","-DSILENT_OBSERVATORY=true","--enable-asserts","bin\main.dart"]
[2:06:46 PM] [Observatory] [Info] [Dart] .. in
C:\Users\Ekundayo\Desktop\fredses_apk
[2:06:46 PM] [Observatory] [Info] [Dart] PID: 12144
[2:06:51 PM] [Observatory] [Info] [Dart] Initialising debugger for ws://
127.0.0.1:65512/Ay03k8HCkVs=/ws
[2:06:51 PM] [Observatory] [Info] [Dart] Connecting to VM Service at ws://
127.0.0.1:65512/Ay03k8HCkVs=/ws
[2:06:52 PM] [Observatory] [Info] [Dart] ==>
{"id":"0","method":"getVersion"}
[2:06:53 PM] [Observatory] [Info] [Dart] <== {"jsonrpc":"2.0",
"result":{"type":"Version","major":3,"minor":28,"_privateMajor":0,"_privateMinor":0},"id":"0"}
[2:06:53 PM] [Observatory] [Info] [Dart] ==> {"id":"1","method":"getVM"}
[2:06:53 PM] [Observatory] [Info] [Dart] <== {"jsonrpc":"2.0",
"result":{"type":"VM","name":"vm","architectureBits":64,"hostCPU":"
Intel(R) Core(TM) i5-3230M CPU @
2.60GHz","operatingSystem":"windows","targetCPU":"x64","version":"2.7.2
(Mon Mar 23 22:11:27 2020 +0100) on
\"windows_x64\"","_profilerMode":"Dart","_nativeZoneMemoryUsage":0,"pid":16452,"startTime":1587280009406,"_embedder":"Dart
VM","_maxRSS":196661248,"_currentRSS":196657152,"isolates":[{"type":"@Isolate","id":"isolates\/315640367711283","name":"main","number":"315640367711283"}],"isolateGroups":[{"type":"@IsolateGroup","id":"isolateGroups\/3151245658533916060","name":"isolate_group","number":"3151245658533916060"},{"type":"@IsolateGroup","id":"isolateGroups\/5036809515278577970","name":"isolate_group","number":"5036809515278577970"},{"type":"@IsolateGroup","id":"isolateGroups\/11525209995569407607","name":"isolate_group","number":"11525209995569407607"},{"type":"@IsolateGroup","id":"isolateGroups\/9388559274354461664","name":"isolate_group","number":"9388559274354461664"}]},"id":"1"}
[2:06:53 PM] [Observatory] [Info] [Dart] ==>
{"id":"2","method":"streamListen","params":{"streamId":"Isolate"}}
[2:06:53 PM] [Observatory] [Info] [Dart] ==>
{"id":"3","method":"streamListen","params":{"streamId":"Extension"}}
[2:06:53 PM] [Observatory] [Info] [Dart] ==>
{"id":"4","method":"streamListen","params":{"streamId":"Debug"}}
[2:06:53 PM] [Observatory] [Info] [Dart] ==>
{"id":"5","method":"streamListen","params":{"streamId":"Service"}}
[2:06:53 PM] [Observatory] [Info] [Dart] ==>
{"id":"6","method":"streamListen","params":{"streamId":"Logging"}}
[2:06:53 PM] [Observatory] [Info] [Dart] ==>
{"id":"7","method":"getIsolate","params":{"isolateId":"isolates/315640367711283"}}
[2:06:53 PM] [Observatory] [Info] [Dart] <==
{"jsonrpc":"2.0","id":"2","result":{"type":"Success"}}
[2:06:53 PM] [Observatory] [Info] [Dart] <==
{"jsonrpc":"2.0","id":"3","result":{"type":"Success"}}
[2:06:53 PM] [Observatory] [Info] [Dart] <==
{"jsonrpc":"2.0","id":"4","result":{"type":"Success"}}
[2:06:53 PM] [Observatory] [Info] [Dart] <==
{"jsonrpc":"2.0","id":"5","result":{"type":"Success"}}
[2:06:53 PM] [Observatory] [Info] [Dart] <==
{"jsonrpc":"2.0","id":"6","result":{"type":"Success"}}
[2:06:54 PM] [Observatory] [Info] [Dart] <==
{"jsonrpc":"2.0","method":"streamNotify","params":{"streamId":"Isolate","event":{"type":"Event","kind":"IsolateExit","isolate":{"type":"@Isolate","id":"isolates\/315640367711283","name":"main","number":"315640367711283"},"timestamp":1587280014117}}}
[2:06:54 PM] [Observatory] [Info] [Dart] Observatory connection closed:
1005 ()
[2:06:59 PM] [Observatory] [Info] [Dart] Disconnect requested!
[2:06:59 PM] [Observatory] [Info] [Dart] TERM: Requested to terminate with
SIGINT...
[2:06:59 PM] [Observatory] [Info] [Dart] TERM: Terminating processes...
[2:06:59 PM] [Observatory] [Info] [Dart] TERM: Terminating related process
16452 with SIGINT...
[2:06:59 PM] [Observatory] [Info] [Dart] TERM: Terminating main process
with SIGINT...
[2:06:59 PM] [Observatory] [Info] [Dart] TERM: Removing all stored data...
[2:06:59 PM] [Observatory] [Info] [Dart] TERM: Waiting for process to
finish...
[2:06:59 PM] [Observatory] [Info] [Dart] Process exited (1)
[2:06:59 PM] [Observatory] [Info] [Dart] TERM: Disconnecting...
[2:06:59 PM] [General] [Info] Debugger:SessionDuration timing: 13365ms
(Dart)
[2:07:07 PM] [General] [Info] Starting debug session...
[2:07:07 PM] [General] [Info] workspace:
C:\Users\Ekundayo\Desktop\fredses_apk
[2:07:07 PM] [General] [Info] program : bin/main.dart
[2:07:07 PM] [General] [Info] Converted program to absolute path:
C:\Users\Ekundayo\Desktop\fredses_apk\bin\main.dart
[2:07:07 PM] [General] [Info] Using workspace as cwd:
C:\Users\Ekundayo\Desktop\fredses_apk
[2:07:07 PM] [General] [Warn] Launch config references non-existant file
C:\Users\Ekundayo\Desktop\fredses_apk\bin\main.dart
[2:07:07 PM] [General] [Info] Detected launch project as Dart
[2:07:07 PM] [General] [Info] Using Dart debug adapter for this session
[2:07:07 PM] [General] [Info] Checking for errors before launching
[2:07:07 PM] [General] [Info] Debug session starting...
{
"name": "Dart",
"program":
"C:\Users\Ekundayo\Desktop\fredses_apk\bin\main.dart",
"request": "launch",
"type": "dart",
"cwd": "C:\Users\Ekundayo\Desktop\fredses_apk",
"toolEnv": {
"FLUTTER_HOST": "VSCode",
"PUB_ENVIRONMENT": "vscode.dart-code"
},
"sendLogsToClient": true,
"globalFlutterArgs": [],
"args": [],
"vmAdditionalArgs": [],
"vmServicePort": 0,
"dartPath": "C:\flutter\bin\cache\dart-sdk\bin\dart.exe",
"maxLogLineLength": 2000,
"pubPath": "C:\flutter\bin\cache\dart-sdk\bin\pub.bat",
"pubSnapshotPath":
"C:\flutter\bin\cache\dart-sdk\bin\snapshots\pub.dart.snapshot",
"debugSdkLibraries": false,
"debugExternalLibraries": true,
"showDartDeveloperLogs": true,
"useFlutterStructuredErrors": true,
"debuggerHandlesPathsEverywhereForBreakpoints": true,
"evaluateGettersInDebugViews": true,
"previewToStringInDebugViews": false,
"useWriteServiceInfo": true,
"debugServer": 60045,
"debuggerType": 0
}
[2:07:08 PM] [Observatory] [Info] [Dart] Spawning
C:\flutter\bin\cache\dart-sdk\bin\dart.exe with args
["--enable-vm-service=0","--pause_isolates_on_start=true","--write-service-info=file:///C:/Users/Ekundayo/AppData/Local/Temp/dart-vm-service-5405.json","-DSILENT_OBSERVATORY=true","--enable-asserts","bin\main.dart"]
[2:07:08 PM] [Observatory] [Info] [Dart] .. in
C:\Users\Ekundayo\Desktop\fredses_apk
[2:07:08 PM] [Observatory] [Info] [Dart] PID: 18016
[2:07:10 PM] [Observatory] [Info] [Dart] Initialising debugger for ws://
127.0.0.1:49152/a37dOWildik=/ws
[2:07:10 PM] [Observatory] [Info] [Dart] Connecting to VM Service at ws://
127.0.0.1:49152/a37dOWildik=/ws
[2:07:11 PM] [Observatory] [Info] [Dart] ==>
{"id":"0","method":"getVersion"}
[2:07:11 PM] [Observatory] [Info] [Dart] <== {"jsonrpc":"2.0",
"result":{"type":"Version","major":3,"minor":28,"_privateMajor":0,"_privateMinor":0},"id":"0"}
[2:07:11 PM] [Observatory] [Info] [Dart] ==> {"id":"1","method":"getVM"}
[2:07:11 PM] [Observatory] [Info] [Dart] <== {"jsonrpc":"2.0",
"result":{"type":"VM","name":"vm","architectureBits":64,"hostCPU":"
Intel(R) Core(TM) i5-3230M CPU @
2.60GHz","operatingSystem":"windows","targetCPU":"x64","version":"2.7.2
(Mon Mar 23 22:11:27 2020 +0100) on
\"windows_x64\"","_profilerMode":"Dart","_nativeZoneMemoryUsage":0,"pid":11208,"startTime":1587280028593,"_embedder":"Dart
VM","_maxRSS":204513280,"_currentRSS":204509184,"isolates":[{"type":"@Isolate","id":"isolates\/1767369391692067","name":"main","number":"1767369391692067"}],"isolateGroups":[{"type":"@IsolateGroup","id":"isolateGroups\/17152143887431477114","name":"isolate_group","number":"17152143887431477114"},{"type":"@IsolateGroup","id":"isolateGroups\/368378634050564530","name":"isolate_group","number":"368378634050564530"},{"type":"@IsolateGroup","id":"isolateGroups\/10628802018320681979","name":"isolate_group","number":"10628802018320681979"},{"type":"@IsolateGroup","id":"isolateGroups\/4116673186035954439","name":"isolate_group","number":"4116673186035954439"}]},"id":"1"}
[2:07:11 PM] [Observatory] [Info] [Dart] ==>
{"id":"2","method":"streamListen","params":{"streamId":"Isolate"}}
[2:07:11 PM] [Observatory] [Info] [Dart] ==>
{"id":"3","method":"streamListen","params":{"streamId":"Extension"}}
[2:07:11 PM] [Observatory] [Info] [Dart] ==>
{"id":"4","method":"streamListen","params":{"streamId":"Debug"}}
[2:07:11 PM] [Observatory] [Info] [Dart] ==>
{"id":"5","method":"streamListen","params":{"streamId":"Service"}}
[2:07:11 PM] [Observatory] [Info] [Dart] ==>
{"id":"6","method":"streamListen","params":{"streamId":"Logging"}}
[2:07:11 PM] [Observatory] [Info] [Dart] ==>
{"id":"7","method":"getIsolate","params":{"isolateId":"isolates/1767369391692067"}}
[2:07:11 PM] [Observatory] [Info] [Dart] <==
{"jsonrpc":"2.0","id":"2","result":{"type":"Success"}}
[2:07:11 PM] [Observatory] [Info] [Dart] <==
{"jsonrpc":"2.0","id":"3","result":{"type":"Success"}}
[2:07:11 PM] [Observatory] [Info] [Dart] <==
{"jsonrpc":"2.0","id":"4","result":{"type":"Success"}}
[2:07:11 PM] [Observatory] [Info] [Dart] <==
{"jsonrpc":"2.0","id":"5","result":{"type":"Success"}}
[2:07:11 PM] [Observatory] [Info] [Dart] <==
{"jsonrpc":"2.0","id":"6","result":{"type":"Success"}}
[2:07:12 PM] [Observatory] [Info] [Dart] <==
{"jsonrpc":"2.0","method":"streamNotify","params":{"streamId":"Isolate","event":{"type":"Event","kind":"IsolateExit","isolate":{"type":"@Isolate","id":"isolates\/1767369391692067","name":"main","number":"1767369391692067"},"timestamp":1587280032444}}}
[2:07:12 PM] [Observatory] [Info] [Dart] Observatory connection closed:
1005 ()
[2:07:17 PM] [Observatory] [Info] [Dart] Disconnect requested!
[2:07:17 PM] [Observatory] [Info] [Dart] TERM: Requested to terminate with
SIGINT...
[2:07:17 PM] [Observatory] [Info] [Dart] TERM: Terminating processes...
[2:07:17 PM] [Observatory] [Info] [Dart] TERM: Terminating related process
11208 with SIGINT...
[2:07:17 PM] [Observatory] [Info] [Dart] TERM: Terminating main process
with SIGINT...
[2:07:17 PM] [Observatory] [Info] [Dart] TERM: Removing all stored data...
[2:07:17 PM] [Observatory] [Info] [Dart] TERM: Waiting for process to
finish...
[2:07:17 PM] [Observatory] [Info] [Dart] Process exited (1)
[2:07:17 PM] [Observatory] [Info] [Dart] TERM: Disconnecting...
[2:07:17 PM] [General] [Info] Debugger:SessionDuration timing: 9451ms (Dart)
Sun Apr 19 2020 [14:08:31 GMT+0700 (Krasnoyarsk Standard Time)] Log file
ended
On Sat, 18 Apr 2020 at 21:35, Danny Tuppeny notifications@github.com
wrote:
Sorry, I should've been clearer! :-)
- Open the VS Code command palette by pressing Ctrl+Shift+P (or on
macOS, Cmd+Shift+P)- Type "capture logs" to filter the command list, and select the Dart:
Capture Logs option- Untick Analysis Server (those logs aren't relevant here) and click
OKThis will start capturing logs from the extension (a notification will be
shown in the bottom right corner that they're being captured).
- Try to launch your app so that you get the original error message
from above- Click Cancel on the logging notification to stop logging, and open
the log file- Check the log file doesn't include anything sensitive (it may have
path/filenames and other things from your project depending on how long you
were capturing)- Save the log file and attach it here
Let me know if anything isn't clear. Thanks!
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/Dart-Code/Dart-Code/issues/2365#issuecomment-615881543,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AOXXRW3V2EXRTEYLRAEM633RNG3DTANCNFSM4MLLZCBA
.
It looks like in your .vscode/launch.json file, you have:
"program":"bin/main.dart"
However this file doesn't exist in your project. If it's a Flutter project, this should be "lib/main.dart"(or, if you've not customised the launch.json, you can just delete the file altogether).
I'm not sure how you ended up with this file with the wrong value though - bin/main.dart is the default value for a (non-Flutter) Dart project. Did you create this file and select the "Dart" template, or has it been created automatically?
Good day, I',m back with almost same problem. I cant debug, its saying
Your launch config references a program that does not exist. If you have
problems launching, check the "program" field in your ".vscode/launch.json"
file.
On Sun, Apr 19, 2020 at 2:54 PM Danny Tuppeny notifications@github.com
wrote:
It looks like in your .vscode/launch.json file, you have:
"program":"bin/main.dart"
However this file doesn't exist in your project. If it's a Flutter
project, this should be "lib/main.dart"(or, if you've not customised the
launch.json, you can just delete the file altogether).I'm not sure how you ended up with this file with the wrong value though -
bin/main.dart is the default value for a (non-Flutter) Dart project. Did
you create this file and select the "Dart" template, or has it been created
automatically?—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/Dart-Code/Dart-Code/issues/2365#issuecomment-616069952,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AOXXRW7D2KBADCHFFU5XW5LRNKU23ANCNFSM4MLLZCBA
.
@trimmdavid this happens if your launch.json has a program field that is not on your disk. Please capture a log by:
Thanks!
Hi Dan unluckily I am also facing the same problem, every thing was going fine and suddenly it stopped working and this alert started to appear at bottom right corner of my screen saying
"Your launch config references a program that does not exist. If you have problems launching, check the "program" field in your ".vscode/launch.json" file."
kindly help me out in this problem.
The above problem is solved, actually I keep on tracking with github so I have the previous working commit of this project, when I checked that out this line:
"program":"bin/main.dart"
It was not their and I didn't made any changes in this file aswell, so I deleted this line and and saved my project and when I reopened it every thing worked fine again like it was working before this error.
Remember I have tried this thing before but I was not closing the editor but when I restarted my editor this alert went of and it started working fine again.
Hello, I had this isuue. I solved it by deleting the launch.js file and creating a new config using vs code.
You shouldn't really need a launch.json for simple cases, it should just work without. Some actions in VS Code will trigger creation of a launch.json though. If anyone can reproduce a situation where a launch.json is created and populated incorrectly with bin/main.dart (which is the default for a Dart project, but not Flutter), please let me know!
If there are other projects/folders on your vscode workspace, check and correct their ".vscode/launch.json" file configs. Or just remove those projects from the workspace.
Thanks, deleting the launch.js file and without creating a new config solved my debug/run problem.
The problem started after a flutter and dart update.
It sounds like a launch.json is being created automatically with incorrect values in it. If anyone is able to reproduce this (and figure out exactly what they did that triggered this - it might be pressing F5 with certain files open, or when the open folder in VS Code is not directly the project root, etc.), please let me know so I can try to get to the bottom of this. Thanks!
Hi Dan,
I ran into this and think i now know reproduceable steps.
It comes down to the workspace the user has in vscode.
If the user's root folder is their flutter project, the flow works as expected.
As seen here:

This is what i see when i hit F5 on a main.dart without a launch.json, with a workspace that has flutter project as the root folder.
I know that I have an issue which necessitates the use of args on flutter run, which is why i get refused to connect.
"args": ["--web-port", "8080", "--web-hostname","127.0.0.1"]
As an aside, it took me so long to find that out. This should be a check in flutter doctor.
If a user, like me, encounters an issue, a natural thing to do would be to hit that glowing orange settings cog in order to
Configure or Fix launch.Json
I do this and select flutter and dart environment.
It creates a launch.json, but doesn't have the 'program' field in there.
however, if the user is in a larger workspace, when we create the launch.json after hitting F5 from our main.dart followed by the Cog icon; we get the following contents:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Dart",
"program": "bin/main.dart",
"request": "launch",
"type": "dart"
}
]
}
Compare this to the 'working' in the less complicated directory structure.
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Flutter",
"request": "launch",
"type": "dart"
}
]
}
Note, there's actually a "name" change too..
You've previously mentioned that in a larger workspace, there can be multiple flutter projects, so the flow that creates the launch.json doesn't know where to go.
I see multiple solutions here (without understanding diffculty to implement.)
"program" : "{$workspace_root}/path/to/file/i/just/tried/to/run/main.dart""program": "bin/main.dart", // Please change this to a path to your main.dart from the workspace root folderI don't use multi-root workspaces, which I think you've mentioned can work.
Let me know if this makes sense and you can also reproduce it.
I know that I have an issue which necessitates the use of args on flutter run, which is why i get refused to connect.
"args": ["--web-port", "8080", "--web-hostname","127.0.0.1"]
As an aside, it took me so long to find that out. This should be a check in flutter doctor.
I'm not sure why using those args would cause this error - please file a bug about that, I believe that should still "just work".
however, if the user is in a larger workspace, when we create the launch.json after hitting F5 from our main.dart followed by the Cog icon; we get the following contents:
Ah, interesting. Can you confirm what your workspace looks like? Have you opened a folder that contains multiple projects, or is it a multi-root workspace with multiple projects?
I hit
F5from the main.dart i actually care about. There should be awareness to have this context create a launch.json for that specific file, ie "program" : "{$workspace_root}/path/to/file/i/just/tried/to/run/main.dart"
Generally if we can infer the file, I'd prefer not to create a launch.json at all. It should only be created when you need to customise something (or want to force a specific program regardless of the open file/project).
A new CTRL+P option to "Debug from this flutter project", which sets up launch.json.
I think this might now be covered by the automatic launch configs?
@danielbee I tried to reproduce what's in your screenshot above, but when I don't have a launch.json the debug side bar shows this welcome view:

How did you get to the the dropdown/cog icon you have without a launch.json?
Hi @DanTup,
Many thanks for getting back to me.
My workspace is set-up like this: (A single folder with multiple projects in sub-directories - Compera_app and compera_test are both flutter projects)

After I hit F5 from my main.dart, i see the following:

Note, I only see the cog after I have hit F5, and during debug. As soon as I close the chrome window or stop (Shift + F5) the application, The debugging screen reverts to what you've shown.
I'm not sure why using those args would cause this error - please file a bug about that, I believe that should still "just work".
Apologies, the opposite is true. Without those args, i get refused to connect. I think my laptop has some organisation/firewall that restricts connections through specific ports. When i don't force the port to be a specific value, dart seems to just give a random port, which doesn't work for me.
Generally if we can infer the file, I'd prefer _not_ to create a
launch.jsonat all. It should only be created when you need to customise something (or want to force a specificprogramregardless of the open file/project).
When I am given the option to create the launch.json (with the cog shown), i'm already in a debug of a running project; so i'd expect the launch.json to map the program field to the application that is currently being run.
I agree that ideally, we don't need any launch.json. However, In my instance i need to create one to work around organisation security and provide launch-specific args.
A new CTRL+P option to "Debug from this flutter project", which sets up launch.json.
I think this might now be covered by the automatic launch configs?
I think this part is what is at fault.

If I click 'Create a launch.json file' then I get a launch.json that has the error:
"version": "0.2.0",
"configurations": [
{
"name": "Dart",
"program": "bin/main.dart",
"request": "launch",
"type": "dart"
}
]
}
If I click show all automatic debug configs:

Then after clicking dart & flutter:

There are no configurations listed.
My workspace is set-up like this:
Thanks - I can repro. The issue here is that your Flutter project is in a sub-folder, so when VS code asks us for the launch.json contents, it's not clear what we should provide (the root folder is neither a Dart or Flutter project). While we could scan the workspace in this case and find your Flutter project, it's also possible we'd find multiple projects. If we return multiple configs here, VS Code would add all of them to the file.
I'll see if maybe we can take some hints from the current open file, so at least in the case where there's an open file (like in your screenshot) we should find something.
Apologies, the opposite is true. Without those args, i get refused to connect. I think my laptop has some organisation/firewall that restricts connections through specific ports. When i don't force the port to be a specific value, dart seems to just give a random port, which doesn't work for me.
Ah, got it. That makes sense now!
Ok, I think I've come up with a reasonable solution for this. For the "Create launch.config", we'll now locate the project roots and create a launch config for each one. In the example above there was only one, but here's an example where the folder had a Dart project and two Flutter projects in it:

Similarly, for the "Automatic launch configs" we'll now scan each of those project roots, rather than just the main workspace root and also include options for Dart web and Test:

i fixed it by replacing package name.
from "bin/main.dart"
to "web/main.dart"
Go .vscode folder open launch.json and
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "projectname",
"request": "launch",
"type": "dart"
}
]
}

sir i am facing problem in which configuration "flutter_first_application" launch.jason missing
@ranadhaval123 please file a new issue, and include the exact steps that led you to that error. Thanks!
Most helpful comment
Thanks, deleting the launch.js file and without creating a new config solved my debug/run problem.
The problem started after a flutter and dart update.