I’m attempting to migrate metadata from one org to another using a package. But my mdapi:deploy command keeps failing with “Error test/applications/Underwriting.app Underwriting invalid cross reference id”

Originally all three .app files in my metadata package were failing. Then I did something (IDK what – I tried a bunch of stuff) that got two of the .app files to deploy and only one is failing now.

Looking at what changed in the .app files that failed but now deploy without error, I notice they no longer contain references to many standard profiles. They only reference custom profiles and the Admin profile. No other standard profiles besides Admin.

Also, if I look at the .app files that continues to cause problems, I see that it contains references to many if not all of the standard profiles. As a result, I suspect it is the inclusion of these standard profiles that is causing problems.

I thought the fix would be easy: go to Setup > App Manager > App Settings > User Profiles, move the standard profiles from the Selected Profiles column to the Available profiles column and then update the package.

The problem is that it does not seem that changes I make to App Manager > App Settings > User Profiles are reflected in the .app files in my metadata.

Removing standard profiles from the app with the .app file producing the error does not remove them from the .app metadata file. Also, adding standard profiles to the apps whose .app files do not contain standard profiles does not add the selected standard profiles to these .app files.

This has left me perplexed. Is the issue the standard profiles in the .app file? If not App Manager > App Settings > User Profiles, how do I control which profiles appear in my .app files?

Note: I’ve searched for similar errors / possible solutions. The first link below sounds most similar but it’s marked as a “fixed” known issue as of a year ago so I don’t think that’s the issue. The second link says there’s an invalid record ID in my code. But the error messages I get identify the files producing the error and I’m 100% positive they do not contain any record (or other IDs).



1 Answer 1


Adding all Profiles to the package was the one thing that resolved the 'invalid cross reference id' errors for the apps on the deployment validation. That was after splitting out the apps from the rest of the deployment to run them after all other metadata components were deployed.

This worked for me as with Copado when we deploy profiles it only deploys the parts that refer to the other components included in the deployment package.

As per this Sf article, 'Error 'Invalid cross reference id' on App Deployment via Change Set': https://help.salesforce.com/s/articleView?id=000390026&type=1

This issue may be of use to some: https://issues.salesforce.com/issue/a028c00000qQ255AAC/special-characters-like-when-included-in-name-of-a-profile-being-deployed-in-an-app-can-cause-invalid-cross-reference-id-error

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .