function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Daniel BoardmanDaniel Boardman 

Error creating a scratch org

I'm using an admin account and using an org setup as "Dev Hub".  

When creating the scratch org:

sfdx force:org:create -f project-scratch-def.json -a AbcScratchOrg

I receive this error message: 

ERROR running force:org:create:  We couldn't create this sandbox or scratch org because the associated Dev Hub isn't authorized. Authorize the Dev Hub and try again.

I've ensured the org is indeed configured as Dev Hub and that the admin user in visual studio code is set:

Sfdx force:config:set defaultdevhubusername=<devhubusername> --global

User-added image

Any ideas/help on what might be the issue would be much appreciated.
 
Best Answer chosen by Daniel Boardman
Alain CabonAlain Cabon
c:\projects>sfdx force:config:list

c\:projects>sfdx force:org:list

 A (D) on the left points to the default Dev Hub org username.

What are the results?

All Answers

Alain CabonAlain Cabon
c:\projects>sfdx force:config:list

c\:projects>sfdx force:org:list

 A (D) on the left points to the default Dev Hub org username.

What are the results?
This was selected as the best answer
Daniel BoardmanDaniel Boardman
Stellar!!  Thanks Alain that set me on the right path for further google searching - and solved the issue. 

I didn't have the (D) for the admin user, nor did I have my "instanceUrl, defaultusername" set from sfdx force:config:set.  I didn't play enough to know if all were required or if only the (D) part on the user was missing.

Thanks a bunch - figured it was something simple being overlooked :)
Justin Catterson 8Justin Catterson 8
I had this error where jq was not installed and appeared to resolve 

https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64
Indhumathi GanesanIndhumathi Ganesan
ERROR running force:org:create:  location is not defined - Facing this issue while creating scratch org. I damn sure my org set as default username and config\project-scratch-def.json in the correct folder. Please help me on this
Kachmar SofiyaKachmar Sofiya
I have the same problem as of today. Until yesterday it worked fine - now can't create a screatch org. I tried:
- reloading comp
- reinstalling sfdx
- created new devHub org
I have (D) 'Connected' next to devhub org.