Custom espidf Fork throws wall of errors

Due to the nature of our project we have to run a custom fork of esp-idf in order to support a larger number of SPI Devices, this in and of itself works fine in an environment where we are purely running esp-idf and compiling/flashing using idf.py.

However we are now attempting to use that same fork of esp-idf in pio and we are getting these errors:

TypeError: can only concatenate str (not "NoneType") to str:
  File "/root/.platformio/penv/lib/python3.8/site-packages/platformio/builder/main.py", line 173:
    env.SConscript("$BUILD_SCRIPT")
  File "/root/.platformio/packages/tool-scons/scons-local-4.6.0/SCons/Script/SConscript.py", line 609:
    return _SConscript(self.fs, *files, **subst_kw)
  File "/root/.platformio/packages/tool-scons/scons-local-4.6.0/SCons/Script/SConscript.py", line 279:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "/root/.platformio/platforms/espressif32/builder/main.py", line 346:
    target_elf = env.BuildProgram()
  File "/root/.platformio/packages/tool-scons/scons-local-4.6.0/SCons/Util/envs.py", line 251:
    return self.method(*nargs, **kwargs)
  File "/root/.platformio/penv/lib/python3.8/site-packages/platformio/builder/tools/piobuild.py", line 61:
    env.ProcessProgramDeps()
  File "/root/.platformio/packages/tool-scons/scons-local-4.6.0/SCons/Util/envs.py", line 251:
    return self.method(*nargs, **kwargs)
  File "/root/.platformio/penv/lib/python3.8/site-packages/platformio/builder/tools/piobuild.py", line 121:
    env.BuildFrameworks(env.get("PIOFRAMEWORK"))
  File "/root/.platformio/packages/tool-scons/scons-local-4.6.0/SCons/Util/envs.py", line 251:
    return self.method(*nargs, **kwargs)
  File "/root/.platformio/penv/lib/python3.8/site-packages/platformio/builder/tools/piobuild.py", line 347:
    SConscript(env.GetFrameworkScript(name), exports="env")
  File "/root/.platformio/packages/tool-scons/scons-local-4.6.0/SCons/Script/SConscript.py", line 673:
    return method(*args, **kw)
  File "/root/.platformio/packages/tool-scons/scons-local-4.6.0/SCons/Script/SConscript.py", line 609:
    return _SConscript(self.fs, *files, **subst_kw)
  File "/root/.platformio/packages/tool-scons/scons-local-4.6.0/SCons/Script/SConscript.py", line 279:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "/root/.platformio/platforms/espressif32/builder/frameworks/espidf.py", line 1251:
    ensure_python_venv_available()
  File "/root/.platformio/platforms/espressif32/builder/frameworks/espidf.py", line 1224:
    venv_dir = get_idf_venv_dir()
  File "/root/.platformio/platforms/espressif32/builder/frameworks/espidf.py", line 1178:
    env.subst("$PROJECT_CORE_DIR"), "penv", ".espidf-" + idf_version

This is our platformio.ini:

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

[common]
build_flags =
    -D ESP_PLATFORM=1
    -D USE_STL
extra_scripts = pre:Build_Tool/preScript.py

[env:esp32s3dev]
platform = espressif32
framework = espidf
board = esp32s3dev
build_flags =
    -I"lib"
    -I"Types"
platform_packages =
    framework-espidf@https://github.com/OEKOSOLVE-FORKS/esp-idf.git#releaseOS/v5.2_modified

We are unsure where our mistake is (if any) as according to all information I was able to find, we should be doing things correctly.

You seem to be running into

I thought so too, however I couldn’t get the solution they proposed using the pre:script.py option to work, both the original solution and the second that was proposed.