Cannot build the project. KeyError: 'value'

Hi, I cannot fix this kind of issue. When trying to build the project Im getting 0 problems but build process is never finished due to KeyError. Any idea how to fix it?

Here is terminal:

> Executing task in folder Test_Project_Framework: C:\Users\shalk\.platformio\penv\Scripts\pio.exe run <

Processing esp12e (platform: espressif8266; board: esp12e; framework: arduino)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/esp12e.html
PLATFORM: Espressif 8266 (2.6.2) > Espressif ESP8266 ESP-12E
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
PACKAGES:
 - framework-arduinoespressif8266 3.20704.0 (2.7.4)
 - tool-esptool 1.413.0 (4.13)
 - tool-esptoolpy 1.20800.0 (2.8.0)
 - toolchain-xtensa 2.40802.200502 (4.8.2)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft

> esp@1.0.0 build
> webpack --mode=production

Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db
Hash: 110bdeef2c8bae2456ea
Version: webpack 4.42.1
Time: 10103ms
Built at: 16. 12. 2020 14:25:23
          Asset      Size  Chunks                    Chunk Names
   ./index.html   452 KiB          [emitted]  [big]
./index.html.gz   118 KiB          [emitted]
      bundle.js   448 KiB       0  [emitted]  [big]  main
   bundle.js.gz   117 KiB          [emitted]
       main.css  3.52 KiB    0, 0  [emitted]         main, main
    main.css.gz  1.01 KiB          [emitted]
Entrypoint main [big] = main.css main.css bundle.js
 [1] ./node_modules/preact/compat/dist/compat.module.js + 2 modules 19.2 KiB {0} [built]
     |    3 modules
 [3] ./gui/js/configuration.json 927 bytes {0} [built]
 [8] ./gui/js/dashboard.json 2.1 KiB {0} [built]
[11] (webpack)/buildin/global.js 472 bytes {0} [built]
[28] ./node_modules/@emotion/is-prop-valid/dist/is-prop-valid.browser.esm.js + 1 modules 4.41 KiB {0} [built]
     |    2 modules
[70] ./gui/js/index.js + 343 modules 897 KiB {0} [built]
     | ./gui/js/index.js 6.51 KiB [built]
     | ./gui/js/comp/UiComponents.js 10 KiB [built]
     | ./gui/js/comp/WifiPage.js 7.92 KiB [built]
     | ./gui/js/functions/configHelpers.js 4.57 KiB [built]
     | ./gui/js/comp/ConfigPage.js 1.96 KiB [built]
     | ./gui/js/comp/DashboardPage.js 4.14 KiB [built]
     | ./gui/js/comp/FilePage.js 393 bytes [built]
     | ./gui/js/comp/FirmwarePage.js 7.62 KiB [built]
     | ./gui/js/comp/DashboardItems.js 7.3 KiB [built]
     | ./gui/js/comp/FileListing.js 8.48 KiB [built]
     | ./gui/js/comp/ControlItem.js 5.52 KiB [built]
     | ./gui/js/comp/DisplayItem.js 2.08 KiB [built]
     |     + 332 hidden modules
    + 403 hidden modules

WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets:
  bundle.js (448 KiB)
  ./index.html (452 KiB)

WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
  main (452 KiB)
      main.css
      bundle.js


WARNING in webpack performance recommendations:
You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
For more info visit https://webpack.js.org/guides/code-splitting/
Child html-webpack-plugin for "index.html":
     1 asset
    Entrypoint undefined = ./index.html
    [0] ./node_modules/html-webpack-plugin/lib/loader.js!./gui/index.html 277 bytes {0} [built]
Child mini-css-extract-plugin ../ESP8266 IoT Framework\node_modules\css-loader\dist\cjs.js!../ESP8266 IoT Framework\node_modules\react-vis\dist\style.css:
    Entrypoint mini-css-extract-plugin = *
       2 modules
KeyError: 'value':
  File "C:\Users\shalk\.platformio\penv\lib\site-packages\platformio\builder\main.py", line 170:
    env.SConscript("$BUILD_SCRIPT")
  File "C:\Users\shalk\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\SConscript.py", line 598:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\shalk\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\SConscript.py", line 287:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "C:\Users\shalk\.platformio\platforms\espressif8266\builder\main.py", line 238:
    target_elf = env.BuildProgram()
  File "C:\Users\shalk\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Environment.py", line 219:
    return self.method(*nargs, **kwargs)
  File "C:\Users\shalk\.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py", line 62:
    env.ProcessProjectDeps()
  File "C:\Users\shalk\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Environment.py", line 219:
    return self.method(*nargs, **kwargs)
  File "C:\Users\shalk\.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py", line 140:
    project_lib_builder = env.ConfigureProjectLibBuilder()
  File "C:\Users\shalk\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Environment.py", line 219:
    return self.method(*nargs, **kwargs)
  File "C:\Users\shalk\.platformio\penv\lib\site-packages\platformio\builder\tools\piolib.py", line 1062:
    project.install_dependencies()
  File "C:\Users\shalk\.platformio\penv\lib\site-packages\platformio\builder\tools\piolib.py", line 880:
    if _is_builtin(spec):
  File "C:\Users\shalk\.platformio\penv\lib\site-packages\platformio\builder\tools\piolib.py", line 872:
    for lb in self.env.GetLibBuilders():
  File "C:\Users\shalk\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Environment.py", line 219:
    return self.method(*nargs, **kwargs)
  File "C:\Users\shalk\.platformio\penv\lib\site-packages\platformio\builder\tools\piolib.py", line 993:
    lb = LibBuilderFactory.new(env, lib_dir)
  File "C:\Users\shalk\.platformio\penv\lib\site-packages\platformio\builder\tools\piolib.py", line 61:
    obj = getattr(sys.modules[__name__], clsname)(env, path, verbose=verbose)
  File "C:\Users\shalk\.platformio\penv\lib\site-packages\platformio\builder\tools\piolib.py", line 137:
    self.process_extra_options()
  File "C:\Users\shalk\.platformio\penv\lib\site-packages\platformio\builder\tools\piolib.py", line 282:
    exports={"env": self.env, "pio_lib_builder": self},
  File "C:\Users\shalk\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\SConscript.py", line 598:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\shalk\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\SConscript.py", line 287:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "C:\Users\shalk\Documents\PlatformIO\Projects\Test_Project_Framework\.pio\libdeps\esp12e\ESP8266 IoT Framework\scripts\preBuild.py", line 45:
    preBuildConfigFun()
  File "C:\Users\shalk\Documents\PlatformIO\Projects\Test_Project_Framework\.pio\libdeps\esp12e\ESP8266 IoT Framework\scripts\preBuildConfig.py", line 43:
    cpp.write("\t" + str(item['value']).lower())
==================================================================== [FAILED] Took 20.84 seconds ====================================================================The terminal process "C:\Users\shalk\.platformio\penv\Scripts\pio.exe 'run'" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

A custom script in this library is failing.

Judging from the code at

It’s trying to read the gui/js/configuration.json file and iterate through an array of objects there with the attributes value, name and length, but it failed to do so.

What exact project are you compiling?

Yes, Im trying to compile the code you mentioned above. I have modified json file with different names, values and it doesnt work although it was working yesterday. It also doesnt work if I used original json files without any change. Still the same issues with KeyError

This is the project Im talking about:

If I clone the referenced project, additionally do a pip3 install asn1crypto because somehow this extra script in the library needs it, then copy the examples/helloWorld/helloWorld.cpp in the src folder and then compile / pio run the project, I get a successful compilation

$ pio run 
Processing nodemcuv2 (platform: espressif8266; board: nodemcuv2; framework: arduino)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/nodemcuv2.html
PLATFORM: Espressif 8266 (2.6.2) > NodeMCU 1.0 (ESP-12E Module)
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
PACKAGES: 
 - framework-arduinoespressif8266 3.20704.0 (2.7.4) 
 - tool-esptool 1.413.0 (4.13) 
 - tool-esptoolpy 1.20800.0 (2.8.0) 
 - toolchain-xtensa 2.40802.200502 (4.8.2)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 34 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <ESP Async WebServer> 1.2.3
|   |-- <ESPAsyncTCP> 1.2.2
|   |   |-- <ESP8266WiFi> 1.0
|   |-- <Hash> 1.0
|   |-- <ESP8266WiFi> 1.0
|   |-- <ArduinoJson> 6.16.0
|-- <ArduinoJson> 6.16.0
|-- <ESP8266WiFi> 1.0
|-- <DNSServer> 1.1.1
|   |-- <ESP8266WiFi> 1.0
|-- <EEPROM> 1.0
|-- <ESP8266HTTPClient> 1.2
|   |-- <ESP8266WiFi> 1.0
|-- <LittleFS(esp8266)> 0.1.0
Building in release mode
Compiling .pio/build/nodemcuv2/src/WiFiManager.cpp.o
..
Archiving .pio/build/nodemcuv2/libFrameworkArduino.a
Indexing .pio/build/nodemcuv2/libFrameworkArduino.a
Linking .pio/build/nodemcuv2/firmware.elf
Building .pio/build/nodemcuv2/firmware.bin
Retrieving maximum program size .pio/build/nodemcuv2/firmware.elf
Checking size .pio/build/nodemcuv2/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=====     ]  45.3% (used 37092 bytes from 81920 bytes)
Flash: [======    ]  56.5% (used 590176 bytes from 1044464 bytes)
Creating BIN file ".pio/build/nodemcuv2/firmware.bin" using "/home/max/.platformio/packages/framework-arduinoespressif8266/bootloaders/eboot/eboot.elf" and ".pio/build/nodemcuv2/firmware.elf"
================ [SUCCESS] Took 35.02 seconds ================

Can you confirm that you can compile such a freshly cloned project in that way, too?

I tried to compile freshly cloned project (HelloWorld, DashBoard and configManager individually) and each time it compiled without errors. Although there were still some warnings in terminal marked yellow or red colour. Your terminal log looks nice without error messages. Asn1crypto I already had installed so it was not causing issues.

I shortened the output I also some code warnings in the library… not critical though.

Yeah but this then fully confirms that your JSON file is broken? What’s the exact content of gui/js/configuration.json?

Well, at the moment Im using original json file, but althought it compiles successfully the functionality is not great. In dashboard I can see this message “There are no items defined in the JSON file” and also in terminal there are plenty of error messages, such as [webpack-cli] Error: Cannot find module ‘html-webpack-plugin’, and a lot of npm ERR! I think I need to install something or Im missing something in order to make it work properly

For project releated errors it’s best to ask at Issues · maakbaas/esp8266-iot-framework · GitHub then.

As your compilation error is solved now by using the original JSON file I’m marking the thread as solved then.

So its not issue of Platformio but project itself? Although before Python reinstallation I could run example with all its functionalities but now I can upload the project but it just doesnt work properly.

You’re saying that with the same .json configuration files you were compiling the project before reinstalling Python and all the functionality was there, and then after reinstalling Python, recompiling the project with the exact same .json file some functionality is gone?

Yes, Im trying to run original examples and now they dont work properly although I can compile them. Getting plenty npm ERR! messages in terminal.

Those are output by the extra script in the library when trying to build the website. Please post these errors in the issue page of the library as linked above to get help. This is completely external to the PlatformIO core.

Thanks. At least I know where to find solution.