I am trying to produce an unlocked package from my VS Code project. The code and components deploy without complaint to my Dev Org (SFDX: Deploy Source to Org) and work according to expectations.

I can also create a package version when (but only when) using the --skipvalidation flag; this deploys to a scratch, sandbox or other dev org and works properly there as well.

But when I try to build a production grade package (leaving away the --skipvalidation) I get a screenful of error messages (the picture shows only the top few lines, there are dozens and dozens more): enter image description here

my command is: sfdx force:package:version:create -p packagename -d force-app -k xxxx -c -w 10 -v devHub

  • I have no idea what to do - am I missing something fundamental?
  • is my code too complex?
  • does it have to do with the fact that I am using nested classes?
  • does it have to do with my using generics (as in SObject instead of Quote)?
  • is it the sheer size or complexity of my classes? (the largest has 932 lines of source code, 447 lines by the unit test's count)
  • none of these guesses seem to be any good: is it a bug in sfdx?

1 Answer 1


It's not any of the factors you articulated, but it is somewhat counterintuitive.

When you create a package version, a build scratch org is created behind the scenes. The features available in that scratch org must match any feature dependencies, such as the use of Quotes, present in your code.

To specify the shape of this build org, you use the --definitionfile config/project-scratch-def.json option to the package version create command.

It sounds, however, like you are building your package in a developer edition org, rather than in a scratch org, so you may not have a definition file available. You can try using the Scratch Org Shape feature, which is in beta, to create a scratch org shape replicating the features of your production org or developer edition org. Alternately, you can explicitly build a definition file that does the feature enablement and setup you need.

In the latter case, you'll definitely need

        "quoteSettings": {
            "enableQuote" : true

in your settings in the definition file, but will likely need other settings as well depending on what the rest of your feature expectations look like.

  • @Dave: thanks that removed most of the errors - and I learned something!
    – willeg
    Feb 19, 2021 at 16:03
  • 1
    I can't tell without more context. Maybe open a new question and include all the details (incl. the Apex code) - that sounds like it may be an Apex test failure.
    – David Reed
    Feb 19, 2021 at 17:15
  • @dave: you are right there; it is actually my code that throws the exception when trying to figure out whether a given field, identified by its name, can be synced between Quote and Opportunity or their line items. I'll do as you say and post a new question -
    – willeg
    Feb 19, 2021 at 20:08

You must log in to answer this question.

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