PlatformIO Community

[Potential dupe] Error: The PlatformIO task detection didn't contribute a task

Hello all,

I am aware that this is pretty much a duplicate of this, as I have the same error, but I have no tasks.json file. Additionally, no build is performed, but the cached .elf size check is performed. How do I fix this?
For those who don’t want to click the link, this is the error, and it occurs whenever the build process is started:

Error: The PlatformIO task detection didn't contribute a task for the following configuration:
{
    "type": "PlatformIO",
    "label": "Build: binary only",
    "task": "Build",
    "group": {
        "kind": "build",
        "isDefault": true
    },
    "problemMatcher": [
        "$platformio"
    ],
    "presentation": {
        "panel": "shared"
    }
}
The task will be ignored.

Thanks!

(Was) Fixed - delete the .pio folder in the project.
EDIT: It’s not fixed any more. It built fine a few times, and now it’s giving the same error, although this time it is running the build process properly.

Are you running the very latest VSCode PlatformIO extension version and core version? (You can open a CLI and execute pio upgrade --dev and restart VSCode to get the latest core version)

What other extensions do you have installed?

EDIT: I’m an idiot. Upgrading PIO did not fix it before. It’s fixed, now, but now I have other problems. I deleted the .platformio folder and uninstalled/reinstalled the extension (uninstall extension, close VSCode, delete .platformio, upgrade VSCode to latest, reinstall platformio, install esp8266 platform, make new test project). My new problem is that when building, it apparently can’t find <utility> and <functional> which is apparently required by Arduino.h.

I’ve upgraded PlatformIO, and it still has the same error. As for extensions, I have:
C/C++ by Microsoft
Notepad++ keymap by Microsoft
PlatformIO (obviously)
SVN by Chris Johnston
SVN Gutter by beaugust
TortoiseSVN by fantasytyx

However, my PlatformIO installation was working for several weeks before this - I was adding and removing some libraries when the error occured.

I’m running VSCode 1.52.1 with PlatformIO extension 2.2.1 and core version 5.0.5a1 and I don’t see this error. My other extensions are C/C++ (microsoft) 1.1.3, Jupyter, LinkerScript, Python and Remote - WSL.

Does removing the .pio and .vscode folder plus executing the project task Default -> Miscellaneous -> Rebuild IntelliSense help?

Check the above edits, doing a full PIO reinstall and making a new project fixed that error, but caused a new one, in that <functional> and <utility> are missing.

First intuition would be to try and build the project once, maybe it just hasn’t downloaded the XTensa compiler yet. In that case, IntelliSense errors are meaningless.

If it does not compile, remove the folders C:\Users\<user>\.platformio\.cache and C:\Users\<user>\.platformio\packages\toolchain-xtensa fully and rebuild. A fresh compiler version should be downloaded.

If it still does not work, please post the platformio.ini and minimal code of the project.

It was when building. Interestingly, I have 2 ESP8266 package installs by the looks of it - framework-arduinoespressif8266@3.20704.0 and framework-arduinoespressif8266. I’ve noticed the same thing with libraries downloaded with the Github link, although with those deleting the ones with versioning/hashes on the end seems to have been fine.

I deleted .cache and the xtensa toolchain, that’s fixed utility and functional for now. However, it couldn’t find pins_arduino.h. I deleted the arduinoespressif8266 folders, and that seems to have fixed it. Very strange.

Then there has been a cascade of broken downloads of the needed packages, somehow. If you experience more strange errors you should be able to delete the C:\Users\<user>\.platformio\packages\ completely.

That’s the Arduino-ESP8266 core framework package. It’s okay to have multiple versions of that since in PlatformIO, project can specify their platform version (like platform = espressif8266@2.6.2) and then PlatformIO needs different versions of certain packages, e.g. the framework.

Thanks for the help. On the .cache folder - previously, the content folder it contained had built up to over 9GB. Any ideas about that?
EDIT: It was after installing a few packages/environments.

My .cache\content folder is 37 kilobytes, with 1,43GB in .cache\downloads. Not sure about what’s being held in there – maybe unpacked downloads for speed? @ivankravets would surely know about that.

The downloads folder was fine, less than a few hundred MB IIRC, along with http and tmp, but I had to delete content with the command line so it didn’t take all day. Running Windows 10, FYI. Thanks for all your help!

Are you sure it was the content folder?

We keep the last downloaded packages for 30 days. If you don’t use them within this period, we do cleanup automatically.

You can manually cleanup cached data with https://docs.platformio.org/en/latest/core/userguide/system/cmd_prune.html

If content's the one that contains pkg-installing-__hashcode, then yes, it was. It contained several thousand of those, I think around 30-something thousand or 3 thousand, I can’t remember properly

Do you use 3rd party antivirus software?

For me that’s in .cache\tmp.

Maybe your antivirus has blocked some installations and that doesn’t get cleaned up? Would also explain a lot about half-installed / corrupted packages you have / had.

Just checked recycle bin - yeah I’m misremembering, it was tmp. No, I only use Windows Defender, and I don’t have the folder protection turned on, it breaks too many of my programs.

I have the same problem as the original concern. I also had a task.json file and nuked it as per the suggestion for the first report incidence. Made no difference. Also, I do not have two platform packages installed; just one for the ESP32Devkit. Here is the exact error message.

Error: The PlatformIO task detection didn't contribute a task for the following configuration:
{
    "type": "PlatformIO",
    "task": "Build",
    "problemMatcher": [
        "$platformio"
    ],
    "group": "build",
    "label": "PlatformIO: Build"
}
The task will be ignored.

Puzzled. Can’t find this text in any file in the work directory. As above, it doesn’t seem to affect the actual build itself, I just keep getting these error messages every time I build something.

I believe what eventually fixed it was to nuke %userprofile%/.platformio and to copy all the project code (and platformio.ini) into a new project.
EDIT: Make sure you have whatever IDE you’re using closed while you do that.