PlatformIO using Debugger in mega2560 "Could not find the specified task"

I’m trying to use the Debugger in the mega2560 and get the error “Could not find the specified task” when I click the “Run and Debug” button for my project. I also have the warning listed below.

I’m having a hard time finding documentation on how to setup for debug. Most documentation and examples don’t mention you have to build for Debug mode. I added that in platform.ini thinking it was needed. Is there a document or example that fully describes what has to be done for Debug? Especially for a mega2560 or similar?

What have I done of not done that is the problem?

Warning in Output:

Error: The PlatformIO task detection didn’t contribute a task for the following configuration:
{
“type”: “PlatformIO”,
“task”: “Pre-Debug”,
“problemMatcher”: [
“$platformio”
],
“label”: “PlatformIO: Build in debug mode”
}
The task will be ignored.

My platform.ini file is:

[platformio]

default_envs = megaatmega2560Debug

[env]

framework = arduino

[env:due]

platform = atmelsam

board = due

[env:megaatmega2560Release]

platform = atmelavr

board = megaatmega2560

[env:megaatmega2560Debug]

platform = atmelavr

board = megaatmega2560

build_type = debug

build_flags = -D DEBUG=1

debug_tool = avr-stub

debug_port = /dev/cu.usbserial-DT03ZORA

debug_init_break = tbreak setup

; GDB stub implementation

lib_deps =

jdolinay/avr-debugger @ ~1.1

My launch.json is:

{
“version”: “0.2.0”,
“configurations”: [
{
“type”: “platformio-debug”,
“request”: “launch”,
“name”: “PIO Debug”,
“executable”: “/Users/zac/Documents/PlatformIO/Projects/RadarRTC/.pio/build/megaatmega2560Debug/firmware.elf”,
“projectEnvName”: “megaatmega2560Debug”,
“toolchainBinDir”: “/Users/zac/.platformio/packages/toolchain-atmelavr/bin”,
“internalConsoleOptions”: “openOnSessionStart”,
“preLaunchTask”: {
“type”: “PlatformIO”,
“task”: “Pre-Debug (megaatmega2560Debug)”
}
},
{
“type”: “platformio-debug”,
“request”: “launch”,
“name”: “PIO Debug (skip Pre-Debug)”,
“executable”: “/Users/zac/Documents/PlatformIO/Projects/RadarRTC/.pio/build/megaatmega2560Debug/firmware.elf”,
“projectEnvName”: “megaatmega2560Debug”,
“toolchainBinDir”: “/Users/zac/.platformio/packages/toolchain-atmelavr/bin”,
“internalConsoleOptions”: “openOnSessionStart”
}
]
}

My tasks.json:

{
“version”: “2.0.0”,
“tasks”: [
{
“type”: “PlatformIO”,
“task”: “Build”,
“problemMatcher”: [
“$platformio”
],
“group”: “build”,
“label”: “PlatformIO: Build”
}
]
}