Skip to main content

Resolving validation errors - “Failed to encode <xxx>, Error retrieving UiFormatSpecificationSet ID”

Possible causes and solutions to "Failed to encode <xxx>" Salesforce validation error

Mykyta Nechepurenko avatar
Written by Mykyta Nechepurenko
Updated this week

Explanation of the error

You may encounter this validation error when deploying a Lightning Page that references a UiFormatSpecificationSet missing from the deployment package.


This dependency is typically created automatically by Salesforce when a Lightning Page includes conditional formatting or visibility rules for fields.

Example of Lightning Page Metadata (XML)

<LightningPage>
<fullName>Account_UIFormat_Test</fullName>
<label>Account UI Format Test</label>
<type>RecordPage</type>
<UiFormatSpecificationSet>TestRuleset</UiFormatSpecificationSet>
</LightningPage>

Resolution

To deploy Lightning Pages successfully, the UiFormatSpecificationSet must be included in your deployment package.

First, add UI format specification set to your metadata filter:


Then, include the referenced specification set:


What if you can’t include it?

In some cases, you may not be able (or want) to include the UiFormatSpecificationSet in a target org. If that’s the case, you’ll need to:

  • Exclude the Lightning Page from your Gearset deployment package, or

  • Recreate or reassign the UiFormatSpecificationSet in the target org to match what the Lightning Page expects.

Disclaimer: This error is returned by Salesforce directly, rather than Gearset. Even so, we offer guidance based on our combined experience with the Metadata API. Where possible, we try to help guide you to fix or avoid this error. In the case that this isn't possible, we may need to direct you to Salesforce support for further clarification.

Did this answer your question?