Pio run yields a key error

After some experimenting with packages and platforms I get this error:

KeyError: 'library-hwlib':
  File "C:\Users\Wouter\.platformio\penv\Lib\site-packages\platformio\builder\main.py", line 167:
    env.LoadPioPlatform()
  File "C:\Users\Wouter\.platformio\packages\tool-scons\scons-local-4.1.0\SCons\Util.py", line 658:
    return self.method(*nargs, **kwargs)
  File "C:\Users\Wouter\.platformio\penv\Lib\site-packages\platformio\builder\tools\pioplatform.py", line 76:
    type_ = p.get_package_type(pkg.metadata.name)
  File "c:\users\wouter\.platformio\penv\lib\site-packages\platformio\platform\base.py", line 179:
    return self.packages[name].get("type")

How can I get rid of this error?

You broke some dev-platform which is located in https://docs.platformio.org/en/latest/projectconf/section_platformio.html#platforms-dir. Try to remove all folders located in the “platforms” directory.

clearing the platforms didn’t help, but clearing the packages did. On to the next hurdle!