PlatformIO Community

Problem with target upload

Hello,

I try to upload a code to my target and

platformio run --target upload
PACKAGES: 
 - framework-arduinoespressif8266 3.20704.0 (2.7.4) 
 - tool-esptool 1.413.0 (4.13) 
 - tool-esptoolpy 1.30000.201119 (3.0.0) 
 - tool-mklittlefs 1.203.210628 (2.3) 
 - tool-mkspiffs 1.200.0 (2.0) 
 - toolchain-xtensa 2.40802.200502 (4.8.2)
Converting bsesp.ino
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
TypeError: __init__() got an unexpected keyword argument 'uri':
  File "/usr/local/lib/python3.9/dist-packages/platformio/builder/main.py", line 178:
    env.SConscript("$BUILD_SCRIPT")
  File "/root/.platformio/packages/tool-scons/scons-local-4.2.0/SCons/Script/SConscript.py", line 597:
    return _SConscript(self.fs, *files, **subst_kw)
  File "/root/.platformio/packages/tool-scons/scons-local-4.2.0/SCons/Script/SConscript.py", line 285:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "/root/.platformio/platforms/espressif8266/builder/main.py", line 238:
    target_elf = env.BuildProgram()
  File "/root/.platformio/packages/tool-scons/scons-local-4.2.0/SCons/Util.py", line 748:
    return self.method(*nargs, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/platformio/builder/tools/platformio.py", line 62:
    env.ProcessProjectDeps()
  File "/root/.platformio/packages/tool-scons/scons-local-4.2.0/SCons/Util.py", line 748:
    return self.method(*nargs, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/platformio/builder/tools/platformio.py", line 141:
    project_lib_builder = env.ConfigureProjectLibBuilder()
  File "/root/.platformio/packages/tool-scons/scons-local-4.2.0/SCons/Util.py", line 748:
    return self.method(*nargs, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/platformio/builder/tools/piolib.py", line 1089:
    project.install_dependencies()
  File "/usr/local/lib/python3.9/dist-packages/platformio/builder/tools/piolib.py", line 913:
    if lm.get_package(spec):
  File "/usr/local/lib/python3.9/dist-packages/platformio/package/manager/base.py", line 236:
    for pkg in self.get_installed():
  File "/usr/local/lib/python3.9/dist-packages/platformio/package/manager/base.py", line 209:
    pkg = PackageItem(pkg_dir)
  File "/usr/local/lib/python3.9/dist-packages/platformio/package/meta.py", line 405:
    self.metadata = self.load_meta()
  File "/usr/local/lib/python3.9/dist-packages/platformio/package/meta.py", line 440:
    return PackageMetaData.load(manifest_path)
  File "/usr/local/lib/python3.9/dist-packages/platformio/package/meta.py", line 393:
    data["spec"] = PackageSpec(**data["spec"])

Looks like some outdated or corrupted package. Please go in the CLI and do a core upgrade and remove all packages + platforms using the commands

pio upgrade --dev
rm -rf ~/.platformio/packages/*
rm -rf ~/.platformio/platforms/*

then build again.