In trying ot create a 2nd-generation managed package, I created a scratch org, added a custom meta data type, and tried to run the following to create a package version using the following:

sf package version create --package "MyPackagName" --installation-key myKeyHere --wait 10 -v [email protected] --verbose

The DevHub org is my production org.

I get the following response:

Error (1): Multiple errors occurred: 
(1) TestCredential.Main_Credential: Custom metadata type TestCredential__mdt is not available in this organization.

I have no idea how to solve this. Any suggestions?


1 Answer 1


This could be simply because you might not have pulled the custom metadata type and the records to your local project folder.

2GP packaging is based on the metadata types in your source folder and not on the org. Make sure your project source folder has all the necessary files and dependencies.

  • I went in the org explorer and pulled it down locally. Anything else it could be? Oct 18, 2023 at 1:11
  • Did you also pull the custom metadata records? Oct 18, 2023 at 4:26
  • Yes I pulled down the 1 metadata record as well -- same result though. Oct 22, 2023 at 13:02
  • Can you please share your folder structure screen shot so we confirm what you missing? Oct 22, 2023 at 17:02

You must log in to answer this question.

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