I had the same problem working on macOS. I suppose the reason of such problem was the location of the project's directory - it was located in the directory synced with iCloud. When I tried to build exactly the same project in another directory, that was not being synced with iCloud, such error have never ever occurred again.