VS2013 TFS "Key not valid for use in specified state" error

My VS 2013 would not connect to any internal or VSO TFS instances today. I also could not remove servers (??). I kept getting “Key not valid for use in specified state”, not matter what I tried. This was particularly frustrating because VS 2012 on the same machine was connecting to everything just fine!

I exited VS and deleted %APPDATA%\Microsoft\VisualStudio\12.0 and %APPDATA%\Microsoft\Team Foundation\5.0 but that did not fix it. After some digging I found someone on Connect had reported same and for them deleting the ‘HKEY_CURRENT_USER\Software\Microsoft\VSCommon\12.0\ClientServices\TokenStorage’ folder got it working again. Sure enough, it fixed me too.

HTH if you find yourself in the same state someday.


Comments (39)

  1. Afshin J. says:

    Thanks for sharing this,

    saved me a day 🙂

  2. Norberto Planchart says:

    Thanks you. 🙂

  3. Onofrei George says:

    Thanks, solved this issue for me.

    After you delete the key from regedit, (even without closing and opening VS instance) when you try to connect to tfs you are required to provide credentials and works fine.

  4. Ahmed says:

    Thx a lot…

    But do you have any explanation?

  5. Matthew says:

    Same, sold what was 4 hours of messing with settings in about 10 seconds! 🙂

  6. Grant says:

    That fixed it up for us. Thanks.

  7. DV says:

    Jap, it works. Thx!

  8. KarthikN says:

    Thanks, this really saved my time.

  9. Bob says:

    Worked like a charm!  Thanks!

  10. Calin Paiusan says:

    Thanks! It works!!

  11. Serge ARADJ says:

    Thank you ! Great post !

  12. nklSaran says:

    It works. Thanks

  13. nolsen says:


  14. Simon says:

    I never post, but this just worked!

  15. dbreaux says:

    Worked great! Thanks so much!

  16. Purvin says:

    it worked. Thanks

  17. Bruce says:

    Yup – worked for me too!

  18. Joseph says:

    Thanks !!!

  19. Daniel Jebakumar says:

    Thank you! Saved me a re-install.

  20. Neehal says:

    It's total saved my time.. awesome.. Thanks a lot….

  21. Bruno César says:

    Nice !

  22. Old Bars says:


  23. Arthi says:

    Thanks, it works !

  24. Binit jha says:

    Working for me too

  25. Walt says:

    Two repairs then remove the folder in registry.

  26. Spurthy Rai says:

    thank you for sharing the info.

  27. User says:

    Thanks for this useful tip. My VS suddenly showed up this error message and i have no clue what to do until i found this post. thanks again for taking your time and posting it here.

  28. saeed hamed says:

    It worked for me as well! Thanks 🙂

  29. mitsamjad says:


  30. Mike says:

    thx dude

  31. Naveen Goel says:

    Thanks for saving my day.

  32. Sohail says:

    Excellenet! It works for me. Thanks

  33. TekPro says:

    Thank you! It worked…Looks like it happened when changed the network password

  34. Padam Negi says:

    thank you. it fixed the issue 🙂

  35. James S says:

    Worked! Thanks

  36. Sarang says:

    Hey It worked !!


  37. duycop says:

    thanks. tôi cài lại máy và không thể nào connect tới TFS. may quá đọc cái này mới biết cách vào lại.