I wonder if this could perhaps be caused by "Check on save: All Targets", being enabled.
However it sounds like that would just be check rather than a build failure, but might be worth trying to disable that and also passing --all-targets on the command line to see if that causes it to fail there?