VS Code Output Shows "deque mutated during iteration" and Other Warnings

Hello everyone,

I’m working on a fresh installation of the Marlin-SKR-mini-E3-V3.0-G0B1 firmware on Windows 10. I downloaded the original folder from BigTreeTech, and I’ve reinstalled both Auto Build Marlin and PlatformIO (Core 6.1.17, VS Code 3.4.4).

When I open the project in VS Code, the PlatformIO project configuration starts automatically, and in the VS Code Output window I see a number of warnings about deprecated configuration options (such as monitor_flags, src_filter, src_build_flags, etc.). These warnings mention that options like src_filter in various environment sections will be removed or renamed in future releases.

After these warnings, the output shows that PlatformIO is installing packages (e.g., ststm32@~14.1.0, toolchain-gccarmnoneeabi, framework-cmsis, and then it installs a package from GitHub for Arduino_Core_STM32 via a URL that forces version 2.6.0).

Eventually, during the configuration phase, the Output ends with a stack trace and the following error:

RuntimeError: deque mutated during iteration:
  File "C:\Users\carde\.platformio\penv\Lib\site-packages\platformio\builder\main.py", line 180:
    env.SConscript(env.GetExtraScripts("post"), exports="env")
  ...
  File "...\buildroot\share\PlatformIO\scripts\marlin.py", line 22:
    for define in env['CPPDEFINES']:

Note: I have not manually triggered a build yet—the error appears during the initial project configuration in VS Code.

This error seems to occur in the post-build script (marlin.py) when iterating over env['CPPDEFINES'].

I’ve seen suggestions online to change the loop from:

python

Copia

for define in env['CPPDEFINES']:

to:

for define in list(env['CPPDEFINES']):

but I’m not sure if this is the recommended fix or if there’s another workaround.

Has anyone encountered this error on a fresh installation on Windows 10? Any advice or known fixes would be greatly appreciated.

Thanks in advance!

This has more to do with a (probably buggy or outdated) script within the Marlin project than with PlatformIO. PlatformIO is just the build tool. The better place to get help is MarlinFirmware/Marlin/issues