abord build if mergeConfig returns an error and fix duplicate error message

Fixes #1940