This error may occur when Xcode cannot resolve a project dependency, e.g. when the project depends on two Swift packages that in turn each want a different version of a third dependency: this leads to a conflict.
Oddly enough, this information won't be shown in the Issue navigator along with the error message. However, if you select your failed build in the Report navigator and expand the logs, it will show the reason.