14

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.

3
  • 2
    It sounds like you need to authenticate again? Try sfdx force:auth:web:login -a "some-alias" -r https://test.salesforce.com/ -s (change some-alias to whatever you'd like to call the sandbox).
    – sfdcfox
    Commented Mar 31, 2019 at 12:45
  • Sometimes it might be a proxy issue. Commented Mar 31, 2019 at 17:15
  • Don't have enough reputation to add an answer, but my issue was that I was pasting in a username with capital letters into my deployment command. Commented Sep 11, 2021 at 3:02

6 Answers 6

25

It may be a problem with aliases.

I have mistakenly created an alias: [email protected]

Then, not aware of consequences I created an alias again, in the way I wanted it in the first place: [email protected]=DevHub

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

DevHub -> [email protected] -> DevHub

So CLI was trying to use DevHub as my username, instead of [email protected]

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=
2
  • 1
    THIS IS THE BEST ANSWER AND SHOULD BE SELECTED AS ONE IN THIS PAGE. IMG moderators should be more strict on letting people selecting their own answer as the best answer even though they're not. This page's selected answer doesn't even provide any explanation.
    – Bahman.A
    Commented Mar 9, 2021 at 22:51
  • @Bahman.A Moderators have no control over answer acceptance. It's completely at the discretion of the asker.
    – David Reed
    Commented Mar 9, 2021 at 23:45
7

Deleting folders "tools", "typings" and the file "sfdx-config.json" and then close and open vscode solved the problem.

3
  • 4
    I tried this, then re-authorize and organization using command SFDX: Authorize an Org. It is working. But why? Care to do some explanation? Or it is just a caching issue?
    – ksugiarto
    Commented Apr 25, 2019 at 11:38
  • It also worked for me.. Anyone knows what is the cause of this?
    – Matej J
    Commented Jan 14, 2021 at 10:44
  • I don't think you even have to delete the tools or typings folders, because just restarting VS Code was enough to fix it for me (after everything else I tried failed). There must be something in the cache that gets stale after refreshing sandboxes or updating org aliases, because restarting VS Code seems to always do the trick. Would be nice to understand more though
    – Sam Howle
    Commented Jul 29, 2021 at 20:41
4

One of the reasons may be conflict in your aliases files. You can find following folder on your computer: %USERPROFILE%/.sfdx and find there file alias.json. There would be all your used aliases and you can investigate if you have any conflicts.

3

I had the same problem just now, working with a developer sandbox and indeed authenticating again solved the issue. Thank you

2
  • authenticating again did not help.
    – osos9
    Commented Apr 2, 2019 at 14:03
  • authenticating again worked for me
    – specimen
    Commented Jul 12, 2021 at 11:48
2

I ran into this problem this week and this is how I solved it:

  1. open the .sfdx folder and manually delete the org configuration file

  2. remove the alias reference in the alias.json file

  3. re-auth into the org in a new terminal window

1

FYI, this happened to me. Specific error I got was: "No org configuration found for name DevHub"

I used the command: sfdx force:config:list to see my configuration values for defaultdevhubusername and defaultusername. I noticed that defaultdevhubusername was just DevHub so I changed this to the username I used to login to my DevHub and it worked. To change, I used command sfdx force:config:set [email protected]

Hope this helps someone else.

You must log in to answer this question.

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