3

When I try to make a scratch org with the command:

sfdx force:org:create --targetdevhubusername DEVHUB --wait 10 --durationdays 1 --definitionfile project-scratch-def.json

I get the following error: enter image description here

My project-scratch-def.json looks like:

  "orgName": "Impact",
  "edition": "Developer",
  "features": [
    "ContactsToMultipleAccounts", "HealthCloudUser", "LightningScheduler", "StateAndCountryPicklist"
  ],
  "settings": {
    "lightningExperienceSettings": {
      "enableS1DesktopEnabled": true
    },
    "securitySettings": {
      "passwordPolicies": {
        "enableSetPasswordInApi": true
      }
    },
    "mobileSettings": {
      "enableS1EncryptedStoragePref2": false
    },
    "accountSettings": {
      "enableRelateContactToMultipleAccounts": true,
      "enableAccountHistoryTracking": true,
      "showViewHierarchyLink": true
    },
    "chatterSettings": {
      "enableChatter": true
    }
  }
}

I had no problem creating scratch orgs before. This error showed up out of nowhere and now it occurs everytime. The only case where I can get the scratch org creation to success is if I remove all the Features and Settings from my project-scratch-def.json, but I need those for my org to have the correct shape. How do I fix this?

1 Answer 1

0

This has bitten me before. This issue appears to crop up when you add addressSettings to your project-scratch-def.json - the scratch fails to create and you then then subsequently remove addressSettings.

The only way I have found to resolve this is to delete the scratch folder in your temp directory prior to running sfdx force:org:create

I'm on a windows box and I located the scratch folder and the subsequent scratch.zip in the default temp dir

Users/YourUser/AppData/Local/Temp

After deleting from here it built as expected with no address settings.

Its worth noting you can set the temp directory using

SFDX_MDAPI_TEMP_DIR

Example:

SFDX_MDAPI_TEMP_DIR=/users/myName/myDXProject/metadata

You can read about it more here

You must log in to answer this question.

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