AttributeError: 'dict' object has no attribute 'get_debug_tool_name'

I wanted to try debugging, using the tutorial but after ‘Start Debugging’ nothing happens and this error is shown in the debug console:

undefinedError: Traceback (most recent call last):
  File "C:\Users\Pascal\.platformio\penv\lib\site-packages\platformio\__main__.py", line 121, in main
    cli()  # pylint: disable=no-value-for-parameter
  File "C:\Users\Pascal\.platformio\penv\lib\site-packages\click\core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "C:\Users\Pascal\.platformio\penv\lib\site-packages\click\core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "C:\Users\Pascal\.platformio\penv\lib\site-packages\platformio\commands\__init__.py", line 44, in invoke
    return super(PlatformioCLI, self).invoke(ctx)
  File "C:\Users\Pascal\.platformio\penv\lib\site-packages\click\core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Users\Pascal\.platformio\penv\lib\site-packages\click\core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Users\Pascal\.platformio\penv\lib\site-packages\click\core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "C:\Users\Pascal\.platformio\penv\lib\site-packages\click\decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "C:\Users\Pascal\.platformio\penv\lib\site-packages\platformio\commands\debug.py", line 98, in cli
    debug_config = DebugConfigFactory.new(
  File "C:\Users\Pascal\.platformio\penv\lib\site-packages\platformio\debug\config\factory.py", line 34, in new
    board_config.get_debug_tool_name(
AttributeError: 'dict' object has no attribute 'get_debug_tool_name'

============================================================

An unexpected error occurred. Further steps:

* Verify that you have the latest version of PlatformIO using
  `pip install -U platformio` command

* Try to find answer in FAQ Troubleshooting section
  https://docs.platformio.org/page/faq.html

* Report this problem to the developers
  https://github.com/platformio/platformio-core/issues

============================================================

I checked and my PIO setup is up-to-date.
running pip install -U platformio or ‘Update All’ command only yields one possible problem:
Updating platformio/contrib-pysite 2.39.201019 @ ~2.39.0 [Incompatible 2.310.220222]

I do have the native toolset, as I can do native unit tests without any problem…
How could I solve this ?
Should I try to reinstall platformio extension ?

Do you use the latest PlatformIO Core? Could you share the output of platformio.ini?

PS C:\Users\Pascal\Documents\PlatformIO\Projects\220303-171038-hello-world> pio  system info
--------------------------  -------------------------------------------------------
PlatformIO Core             5.2.5
Python                      3.9.10-final.0
System Type                 windows_amd64
Platform                    Windows-10
File System Encoding        utf-8
Locale Encoding             cp1252
PlatformIO Core Directory   C:\Users\Pascal\.platformio
PlatformIO Core Executable  C:\Users\Pascal\.platformio\penv\Scripts\platformio.exe
Python Executable           C:\Users\Pascal\.platformio\penv\Scripts\python.exe
Global Libraries            0
Development Platforms       6
Tools & Toolchains          42
--------------------------  -------------------------------------------------------

platformio.ini is standard from the hello world example

; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter, extra scripting
;   Upload options: custom port, speed and extra flags
;   Library options: dependencies, extra library storages
;
; Please visit documentation for the other options and examples
; http://docs.platformio.org/page/projectconf.html
[env:native]
platform = native

Can you use the CLI to pio platform update native and retry?

PS C:\Users\Pascal\Documents\PlatformIO\Projects\220303-171038-hello-world> pio platform update native
Platform native
--------       
Updating platformio/native                    1.1.4                              [Up-to-date]

Starting debug yields the same error…
Let me try all this on a new fresh PC, to rule out a corrupt setup on my side…
Will post again as soon as I have new info.

This is definitely working on my side

[env:native]
platform = native

just with code above.

No other modifications.

1 Like

ok, on a fresh setup I no longer have this error, so I assume something is corrupt on my workhorse PC, let’s forget about it, I will reinstall the toolchain.

one more thing @maxgerhardt @ivankravets :
on March 26th it is Arduino Week 2022. There was a call for speakers, and I applied with a talk “Developing Arduino Libraries with Platformio” and my talk was accepted.
Talks needed to be pre-recorded, which I have done by now and it was approved by the Arduino Team. As soon as I have a link to the event / recording I will let you know.

Have a nice weekend.

1 Like

@strooom, thanks for your contribution to the PlatformIO ecosystem. Please share with us a link and we would be glad to promote it on our social network.

Problem returned so I investigated in more detail. Looks like a bug so I created issue :

Having a custom board definition in boards folder breaks debugging of native unit tests · Issue #4817 · platformio/platformio-core (github.com)