(I removed 2 other replies to this, pending moderation, after more than 24 hours)
I have exact same problem (Python 3.10.14)
When following the steps mentioned in:

building.md

python3 -m venv python3-venv --prompt mongo 
source python3-venv/bin/activate
buildscripts/poetry_sync.sh
python3 buildscripts/scons.py --build-profile=opt

The last statement is bailing out with the error mentioned.
Adding BAZEL_FLAGS=–config=local to the scons line has NO EFFECT
Any help on this appreciated.