Error: Not a valid enumeration for type: class com.sforce.soap.metadata.Gender

When working with copado you might receive an email with the details below:

"Details:  Status: Broken-Xml-File(s)
Error loading metadata file 'ObjectName__c-da.objectTranslation': Not a valid enumeration for type: class com.sforce.soap.metadata.Gender"

Let's analyse the error.

Broken-Xml-Files(s) -> This means one or more of your xml files in Git contains incorrect data.
What files? If you check the rest of the information in the email, you will see:
Error loading metadata file 'ObjectName__c-da.objectTranslation' -> This is the file that is broken in Git.
What is exactly broken? This is also provided on the error:
Not a valid enumeration for type: class com.sforce.soap.metadata.Gender -> The value in the tag Gender in the file above is incorrect.

So, now you know what file in Git is failing and why but, this file exist in different branches in your repository. In which one is the file broken? Well, it might be broken in several branches but, you can start checking the branches involved in the operation you were performing when you received the email with error.

If you were committing in a user story, check the affected file in the master branch and source branch. 
If you were promoting and/or deploying, check the affected file in the feature branch, promotion branch and destination branch.

How to avoid this issue in the future once all the branches have been fixed?
The issue is being caused most likely by the value <!-- Neuter --> in the tag <gender></gender> in the .xml file provided in the error. That kind of value is not supported and it's breaking the .xml file.

When retrieving the object translation and the corresponding object, the object translation .xml file retrieved by the Salesforce Metadata API contains the values not translated added in the tags with comments. This is causing an issue with a particular tag: <gender><!-- Neuter --></gender> 

The value <!-- Neuter --> in that tag is not parsed by the Salesforce java libraries and it's causing issues. 

This commented values are retrieved by the Salesforce Metadata API, Copado is not adding any of this values.

The feature Global Find and Replace Rules can be used to make sure the value <!-- Neuter --> is never committed again into the translation file. Below are 2 examples of rules that can be used. 

Please note that creating or editing rules and regex in this file are out of scope of Copado Support. If you need help you with such configuration, feel free to contact your Customer Success Manager to engage with our Professional Services organization who will be able to support you.

The following rules are pasted as images to avoid issues with hidden characters when using the Copy and Paste functionality.

Remove the tag <gender><!-- Neuter --></gender> completely.

User-added image

Change <gender><!-- Neuter --></gender> into <gender>Neuter</gender>. 

User-added image

How did we do?