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 (47)

  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. Simon says:

    I never post, but this just worked!

  14. dbreaux says:

    Worked great! Thanks so much!

  15. Purvin says:

    it worked. Thanks

  16. Bruce says:

    Yup – worked for me too!

  17. Daniel Jebakumar says:

    Thank you! Saved me a re-install.

  18. Neehal says:

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

  19. Arthi says:

    Thanks, it works !

  20. Binit jha says:

    Working for me too

  21. Walt says:

    Two repairs then remove the folder in registry.

  22. Spurthy Rai says:

    thank you for sharing the info.

  23. 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.

  24. saeed hamed says:

    It worked for me as well! Thanks 🙂

  25. Naveen Goel says:

    Thanks for saving my day.

  26. Sohail says:

    Excellenet! It works for me. Thanks

  27. TekPro says:

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

  28. Padam Negi says:

    thank you. it fixed the issue 🙂

  29. James S says:

    Worked! Thanks

  30. Sarang says:

    Hey It worked !!


  31. 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.

  32. Babatola Awe says:

    Thanks Trveor

  33. Mihai says:

    Worked like a charm!
    Thanks a lot!

  34. Habeeb says:

    Thanks a lot for sharing this which solved my issue.

  35. Ayaz says:

    Thank you … Was tired since morning solving this error.. Atlast came acrross to this solution.
    A very big thank you :p

  36. hussein says:

    thank you bro

  37. Javier G says:

    You’re advise is still working two years later! Thank you!

  38. mdegoey says:

    Even over three years later this solution is still useful. Thanks for posting it.

  39. Frank J. says:

    thanks 🙂
    VS2013 started crashing with a argumentnullexception for me. Had to delete pretty much everything in appdata to get VS2013 working again, but then I got the “key not valid for use in specified state”-error. Deleting the Tokenstorage from registry solved it.

Skip to main content