I’ve done this before at e.g. Hang creating new projects. Hang using pio install - #2 by maxgerhardt
As a sanity check you can see if it occurs for other projects too (that use a different compiler). If you follow PlatformIO IDE for VSCode — PlatformIO latest documentation to create a blinky example for an Arduino Uno, does compilation fail in the same way? (Don’t forget to use the project environment switcher to switch to the unoenvironment of the newly created project)