Pio check cppccheck addon error

I am trying to use the cppcheck misra addon. If I run

pio check -v --flags "cppcheck: --addon=misra.json"

I get this python error

Bailing out from checking F:\arduino\platformio mkrzero test\src\main.cpp since there was an internal error: Failed to execute 'c:\users\ian66\.platformio\penv\scripts\python.exe C:\Users\ian66\.platformio\packages\tool-cppcheck\addons\misra.py --cli --rule-texts=misra-rules.txt "F:\arduino\platformio mkrzero test\src\main.cpp.dump"'. Traceback (most recent call last):

  File "C:\Users\ian66\.platformio\packages\tool-cppcheck\addons\misra.py", line 3620, in <module>


  File "C:\Users\ian66\.platformio\packages\tool-cppcheck\addons\misra.py", line 3564, in main


  File "C:\Users\ian66\.platformio\packages\tool-cppcheck\addons\misra.py", line 3369, in parseDump

for cfgNumber, cfg in enumerate(data.iterconfigurations()):

  File "C:\Users\ian66\.platformio\packages\tool-cppcheck\addons\cppcheckdata.py", line 927, in iterconfigurations


  File "C:\Users\ian66\.platformio\packages\tool-cppcheck\addons\cppcheckdata.py", line 740, in setIdMap


  File "C:\Users\ian66\.platformio\packages\tool-cppcheck\addons\cppcheckdata.py", line 727, in set_id_map


  File "C:\Users\ian66\.platformio\packages\tool-cppcheck\addons\cppcheckdata.py", line 396, in setId


KeyError: '000001B540564840'

Please post this issue, along with the project files that it can be reproduced with, at Issues · platformio/platformio-core · GitHub.


For me, the problem was resolved after I edited the projects and checked “Enable Code Analysis on Build”. I was then able to uncheck this option, but it leaves


in the vcxproj file, which seems to resolve the problem.