[SalesForce] SFDX – No org configuration found for name

Suddenly vscode stopped working with deploying the class to the sandbox I'm using and throws this message "No org configuration found for name INSTANCE NAME"

I tried to create a new project for the sandbox but still get the same error when I'm trying to retrieve all the classes from the org.

sfdx update didn't help.

Best Answer

It may be a problem with aliases.

I have mistakenly created an alias: DevHub=me@salesforce.com

Then, not aware of consequences I created an alias again, in the way I wanted it in the first place: me@salesforce.com=DevHub

So I ended up having two aliases, which were translated by the CLI:

DevHub -> me@salesforce.com -> DevHub

So CLI was trying to use DevHub as my username, instead of me@salesforce.com

Hence, the error: No org configuration found for name DevHub

Verify Your aliases with:

sfdx force:alias:list

and delete unnecessary aliases (if any) by setting them as empty:

sfdx force:alias:set DevHub=