Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Salesforce
  3. Question
Salesforce

Error while creating scratch Org

Asked by Lessie Schur Aug 7, 2021 908 views 3 answers
Share

About this question

I was trying to create a scratch def org following the trailhead

https://trailhead.salesforce.com/content/learn/projects/quick-start-salesforce-dx/create-and-test-our-scratch-org?trail_id=sfdx_get_started

But get stuck in the following section Create and Test Our Scratch Org - Step 2

while executing the following command getting the following error.

sfdx force:org:create -s -f config/project-scratch-def.json -a dreamhouse-org

ERROR running force:org:create: Must pass a username and/or OAuth options when creating an AuthInfo instance.

Steps Executed


Created Project in VSCode

Authorized an Org

Executed Trailhead steps as mentioned in the link

How can I resolve the error while creating scratch def org?

Your answer

3 Answers

Kiarraherman Latest answer

Answered on Jul 15, 2025

Dev Hub must be enabled in the Salesforce Developer Edition organization or the Trailhead Playground organization you are using. Make sure you are logged in to the Dev Hub organization. Dev Hub is enabled in that organization. If it is not enabled, go to Salesforce => find "Dev Hub" in the settings and turn on "Enable Dev Hub".

Was this helpful?

Stephaniebaldwin

Answered on Jul 6, 2025

Go to Dev Hub org (Salesforce Production org / Developer Edition org that you use as Dev Hub). Then go to Setup → find Dev Hub → make sure you have Enabled Dev Hub (enable the solitaired checkbox). Finally click Save to undo.

Was this helpful?

More Salesforce discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Salesforce Blogs

Guides, tips and career advice on Salesforce from JanBask experts.