Skip to main content
All CollectionsTroubleshootingComparisons
How to use the bisection method to debug retrieval errors?
How to use the bisection method to debug retrieval errors?

Guidance on how to use bisection method to troubleshoot metadata retrieval errors, including Salesforce Gack code errors.

Valerio Chang avatar
Written by Valerio Chang
Updated over 3 months ago

Quite often, when comparing metadata, some users 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 comparison filter will contain 63 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 of the previous test, as this half of the list will contain the problem object.

  • Repeat previous step with the problem half of the list until you work out which metadata type is causing the error.

A diagram showing the process of bisection to determine the problem object within a metadata filter.

So instead of 63 tests you can figure out the problematic type in 6 comparisons. 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.

Sometimes the root cause is a particular item in the metadata type. You may want to use the Specify named items and rules filter to further narrow down the problem item.

Did this answer your question?