Skip to main content
All CollectionsTroubleshootingSalesforce validation errors
Resolving validation errors - "Component names can only contain alphanumeric characters, hyphens, colons, and underscores. Correct label in <xxx>.json and try again."
Resolving validation errors - "Component names can only contain alphanumeric characters, hyphens, colons, and underscores. Correct label in <xxx>.json and try again."

Cause and solution to this Salesforce validation error

Mateusz Kochanowicz avatar
Written by Mateusz Kochanowicz
Updated this week

Error overview

This Salesforce validation error that Gearset is surfacing is usually related to the ExperienceBundle metadata component.

An example of the error message in our app looks as below:

"Component names can only contain alphanumeric characters, hyphens, colons, and underscores. Correct label in Tenable_Partner_Community1/brandingSets/brandingSet.json and try again."

Explanation of the error

The error is usually caused by "label" within the failing brandingSet.json file. It's likely that label contains an invalid value that Salesforce doesn't allow.

A "null" value, or missing label would also fail validation when deploying BrandingSet metadata.

On the above example the failing file name is "Tenable_Partner_Community1/brandingSets/brandingSet.json" and the value for the "label" was set to "null", which caused the error.

An example of the .json file where the "label" is set to "null" may look as below:

{
"fullName": "Tenable_Partner_Community1",
"label": null,
"brandingSetPropertyValues": [
{
"propertyName": "headerBackgroundColor",
"value": "#0033A0"
},
{
"propertyName": "primaryColor",
"value": "#00A1DE"
}
],
"description": "Branding set for Tenable Partner Community",
"type": "Community"
}

Salesforce requires the label to be a non-empty string that follows the allowed naming conventions (alphanumeric, hyphens, colons, and underscores).

Resolution

To resolve the error, follow below guidance.

For org to org deployments

  • Download the deployment package (.zip) created in Gearset.

  • Make the change locally in the affected .json file by correcting the value for the label.

  • Once the .json file is amended, re-run the comparison in Gearset using "Local files" option as the source of your deployment on Compare and deploy page.

  • Select the amended deployment package (.zip), and validate it against the target org.

Guidelines on how to download and amend the deployment package:
How can I change the deployment package before deploying?

Useful resources

More information on this error on Salesforce Stack Exchange forum.

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?