Demo repository for this issue: NomicFoundation/hardhat#4382
$ yarn
$ yarn clean
$ yarn compile:error
Run both commands several times until it fails
You can also run:
$ yarn compile:success
To see that it works fine when concurrency is not used in Lerna