Quite often, when comparing metadata, some user's orgs will return a cryptic Salesforce error during retrieval. We can help work out which specific metadata type and metadata item is causing this error.

The first step is to find out how many metadata type are included in your metadata filter. For example the default filter will contain 64 metadata types.

We could test each individual metadata type to work out which type generates the error, but there is a faster way:

  • Divide the metadata type into 2 halves and test which half generates the error. This narrows down the issue to 1/2 the previous test.

  • Repeat previous step until you work out which metadata type is causing the error.

So instead of 64 tests you can figure out the problematic type in 6 runs. Be aware that it's possible that multiple metadata types are corrupted and sometimes both halves may error.

After identifying the metadata type(s) that is erroring out you can use this guide to replicate this in Workbench and confirm if this is an API problem or not.

Some times the root cause is a particular item in the metadata type. You may want to use the Named items filter to further narrow down the problem item.

Did this answer your question?