Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VScode debug mode shows "Could not find the specified task"

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?

like image 289
samthegolden Avatar asked Jan 25 '23 01:01

samthegolden


1 Answers

Change:

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

To:

"preLaunchTask": "audit_tunnel"
like image 173
Milos Grujic Avatar answered Jan 29 '23 11:01

Milos Grujic