I need to add a new class to an existing 2GP managed package. I get the following error when I attempt to create the package using the SF CLI. How do I resolve this issue when I attempt to build it?

We couldn’t create this package version because new components were added or existing components were deleted. Remove components {ApexClass=[ckz_PIM_ScheduledCacheRebuild]} from the package version, and create the package version again.


The current managed package that was released was 1.0.2

I modified my sfdx-project.json so that the ancestorId is set to the 1.0.2 package id.

The versionNumber is set to

I still get the same error message when attempting to create the managed package. Any help would be appreciated!

  • Did you set a new target number for the version with appropriate ancestor version?
    – Phil W
    Commented Jun 9, 2020 at 20:04
  • @PhilW the previous version was, so I was trying to create Is that the right way to do it? Commented Jun 10, 2020 at 0:36

1 Answer 1


I worked with a colleague on this. The answer was to create the new package version as 1.1.0-1. For some reason, using was not accepted. Having the beta version number be something other than zero was the answer.

  • I am seeing similar error. Add components {Profile=[Admin]} back into the package version, and create the package version again. This is my current sfdx-project json of managed package : "versionName": "1.2", "versionNumber": "1.2.0.NEXT", "ancestorVersion": "" And now I am creating new beta package with this: "versionName": "1.3", "versionNumber": "1.3.0.NEXT", "ancestorVersion": "" any suggestions? Commented Jun 11, 2022 at 2:52

You must log in to answer this question.

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