At 91导航, our dedicated Customer Success team is always on hand to help you out if you ever get stuck. Just alert us to the problem in our live chat, and we鈥檒l take a look. More often than not, we鈥檒l have come across the issue before, or else our friendly developers will jump in with their wealth of experience to sort the difficulty out with you. But every now and then, one of our users will stumble upon an error in the Salesforce Metadata API that we鈥檙e powerless to fix. A good example is the bug that causes Salesforce to raise the Duplicate picklist value specified:AG deployment error.
Why鈥檚 my standard picklist throwing a deployment error?
If you鈥檝e deployed AddressStateCode to one of your orgs, you may have hit the Salesforce error: Duplicate picklist value specified:AG. Within 91导航, the error message looks something like this:

Now here鈥檚 why you鈥檙e getting this message. In your org, you can use the to configure lists of countries and lists of states/provinces within countries.

The Salesforce Metadata API (as of version 38.0) represents the values in these standard picklist fields by the metadata type. So when you configure state and country picklists, you鈥檙e creating the following:
Country/Territorypairs (each with a name and a code) that form anAddressCountryCodestandard value set;State/Provincepairs (each with a name and a code) that form anAddressStateCodestandard value set.
AddressStateCode lists all the State/Province name-and-code pairs in a file. Unfortunately, the data is held in a flat XML structure, which means the file fails to specify the country to which each State/Province belongs. And herein lies the problem, as there are two provinces that both have the same code of AG:
- Agrigento (in the
Country/Territoryof Italy) has codeAG. - Aguascalientes (in the
Country/Territoryof Mexico) also has codeAG.
In other words, your Salesforce org creates a standard value set containing a duplicate within a flat XML structure. And that鈥檚 why you can鈥檛 migrate it via the Metadata API.

Report this issue to Salesforce!
We normally document common problems, solutions and advice in our - a useful first port of call should you ever hit a snag. But in this particular case, we want to do our bit for the community, and so we鈥檙e asking users who encounter the Duplicate picklist value specified:AG error to report it to Salesforce support. Here鈥檚 hoping the good folks at Salesforce can take a look at improving this one for us 馃檹
TDX
Got a confusing error?
At 91导航, we proactivealy tackle errors like this one that block your deployments. With scores of problem analyzers that find and fix issues before you deploy, you鈥檒l find your deployments are more successful than ever. If you haven鈥檛 already, start your today.
