12

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
    Mar 31 '19 at 12:45
  • Sometimes it might be a proxy issue. Mar 31 '19 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. Sep 11 at 3:02
20

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=
2
  • 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
    Mar 9 at 22:51
  • @Bahman.A Moderators have no control over answer acceptance. It's completely at the discretion of the asker.
    – David Reed
    Mar 9 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
    Apr 25 '19 at 11:38
  • It also worked for me.. Anyone knows what is the cause of this?
    – Matej J
    Jan 14 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
    Jul 29 at 20:41
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
    Apr 2 '19 at 14:03
  • authenticating again worked for me
    – specimen
    Jul 12 at 11:48
2

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.

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 defaultdevhubusername=myusername@domain.com

Hope this helps someone else.

1

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.