I am trying to create a new package version using 2GP.

When I run this command

sfdx force:package:version:create ...

I am getting this error:

ERROR running force:package:version:create: Can’t create package version. Removing metadata components from a second-generation managed package is a pilot feature that requires acceptance into a pilot program.

At the time of posting, the Partner Community support section is broken, so I cannot raise a case.

Based on the error message, it obviously thinks I've deleted something, is there a command I can run to figure out what the deleted metadata is?

  • 1
    don't you version control your metadata? Feb 9 '21 at 17:26
  • 1
    I do. But my git install got corrupt, so there was a 3 month period when I didn't commit any changes... 🤦🏼‍♂️
    – Robs
    Feb 9 '21 at 17:44

EDIT: The bug has been fixed and the error message now contains the metadata components that you are trying to delete

Original answer:

There is no way to see the root cause of the error without opening a Case

They have created a Known Issue about this -- that is, the error message should identify the metadata you're attempting to delete:


Additionally, in our case, the problem was due to Profiles in package directories OUTSIDE of the package directory that I was trying to package. Apparently the 2GP packaging process pays attention to Profiles in ALL of the directories listed in the packageDirectories array in sfdx-project.json when computing the metadata payload to send up for packaging. If you delete a Profile from one of these directories, you get the error documented by the OP

  • does this require premier support?
    – Patlatus
    May 20 '21 at 13:50
  • Yes, to get to the root cause of the error above, we had to use Premier Support. However, the bug has been fixed now for about 2 months and you will now get an error message that enumerates the list of components that you're trying to delete when building the package version
    – daveespo
    May 20 '21 at 18:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.