10

When trying to start a Debug session in vscode, it throws an error about not finding a specified task. I've already tried the solutions of other SO questions like this but without success.

launch.json:

{ // 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": "MSEventHubs_Audit", "type": "python", "request": "launch", "program": "${workspaceFolder}/audit-events.py", "console": "integratedTerminal", "args": [ "config/config.ini", ], "envFile": "${workspaceFolder}/.env", "env": {"PYTHONPATH": "${workspaceRoot}"}, "justMyCode": false, "preLaunchTask": { "task": "audit_tunnel" } }, { ... }, ] } 

tasks.json:

{ // See https://go.microsoft.com/fwlink/?LinkId=733558 // for the documentation about the tasks.json format "version": "2.0.0", "command": "", "args": [], "tasks": [ { "label": "activate_key", "type": "shell", "command": "smartOS_card_pin.sh", "args": [ "${inputs:cardos_pass}" ], "group": "build", }, { "label": "audit_tunnel", "type": "shell", "group": "build", "command": "ssh", "args": [ "-NL", "port1:127.0.0.1:port2", "my_host" ], "dependsOn": "activate_key" }, { ... } ], "inputs": [ { "id": "cardos_pass", "type": "promptString", "password": true } ] } 

I've been looking at it for a while and cannot figure out what I'm doing wrong. The proof my task is known by vscode is when the pop-up message appears

enter image description here

I click 'Configure Task', the 'audit_tunnel' appears as an option to edit.

enter image description here

What am I missing?

2
  • I would remove "command": "", "args": [], from the top of your tasks.json - that looks like the previous syntax. See code.visualstudio.com/Docs/editor/tasks#_migrating-to-tasks-200. Secondly, if you just run audit_tunnel by itself, can it be found? You could just put an echo in there to make it easy. Commented May 11, 2020 at 13:20
  • Yes @Mark , I can run the task directly. And your suggestion did not work. Commented May 11, 2020 at 16:28

1 Answer 1

22

Change:

"preLaunchTask": { "task": "audit_tunnel" } 

To:

"preLaunchTask": "audit_tunnel" 
Sign up to request clarification or add additional context in comments.

1 Comment

The above at least improved things for me, now it's a bit more specific and says, "Could not find the task '/home/user/some/task.json'" even though the file exists.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.