Serialized objects lossing references in Unity 5.6.3p2 command line build

When building on one of our build machine by command line some prefabs loaded into the scene had a broken reference for an Animation Controller that is set in the prefab, this error only happens when building in batch mode and doesn’t happen all the times as we have more build machines that don’t have this problem.

Even doing a clean build the problem persists, we are using perforce as a source control and some of this broken prefabs when reimporting them to unity they are changed to Unix encoding from Windows encoding, could this cause any problem when doing a batch build? our normal builds are fine, and some build machines are doing fine too without any changes. Also the problem seems to disappear if we submit the new encoded file, but just for that build, could this be an asset importing issue?

Does the encoding of a prefab could affect the load of it in the scene? As this happens on both instances that are in the scene from the start and prefabs been Instantiated into the scene during gameplay

We cannot reproduce this on Editor so we can’t see what is the status of the Animation Controller at that moment, could the Animation Controller reference be null at the Start of an script attached to the prefab?

Any help will be greatly appreciated, and if you need more info let me know

The problem is fixed when we disable the OnValidate functions for this prefabs, is there any know issues with OnValidate and batch mode? is there a way to force an OnValidate run in this mode as it happens when loading assets in editor?