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.
--Trev
Comments
Anonymous
February 05, 2014
Thanks for sharing this, saved me a day :)Anonymous
February 17, 2014
Thanks you. :)Anonymous
February 22, 2014
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.Anonymous
March 08, 2014
Thx a lot... But do you have any explanation?Anonymous
March 11, 2014
Sweet.Anonymous
March 22, 2014
Same, sold what was 4 hours of messing with settings in about 10 seconds! :-)Anonymous
March 26, 2014
That fixed it up for us. Thanks.Anonymous
April 07, 2014
The comment has been removedAnonymous
April 08, 2014
Thanks, this really saved my time.Anonymous
April 10, 2014
Gratz!Anonymous
May 01, 2014
Worked like a charm! Thanks!Anonymous
May 04, 2014
Thanks! It works!!Anonymous
May 11, 2014
Thank you ! Great post !Anonymous
May 12, 2014
It works. ThanksAnonymous
June 02, 2014
Thanks!Anonymous
June 08, 2014
I never post, but this just worked!Anonymous
June 12, 2014
Worked great! Thanks so much!Anonymous
June 20, 2014
it worked. ThanksAnonymous
July 03, 2014
Yup - worked for me too!Anonymous
September 16, 2014
Thanks !!!Anonymous
September 29, 2014
Thank you! Saved me a re-install.Anonymous
October 09, 2014
It's total saved my time.. awesome.. Thanks a lot....Anonymous
October 21, 2014
Nice !Anonymous
November 05, 2014
ThanksAnonymous
November 24, 2014
Thanks, it works !Anonymous
December 17, 2014
Working for me tooAnonymous
January 08, 2015
Two repairs then remove the folder in registry.Anonymous
January 15, 2015
thank you for sharing the info.Anonymous
February 02, 2015
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.Anonymous
March 05, 2015
It worked for me as well! Thanks :)Anonymous
April 07, 2015
ThanksAnonymous
May 12, 2015
thx dudeAnonymous
June 14, 2015
Thanks for saving my day.Anonymous
June 28, 2015
Excellenet! It works for me. ThanksAnonymous
July 31, 2015
Thank you! It worked...Looks like it happened when changed the network passwordAnonymous
November 01, 2015
thank you. it fixed the issue :)Anonymous
November 18, 2015
Worked! ThanksAnonymous
March 02, 2016
Hey It worked !!:-)ThanksAnonymous
March 16, 2016
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.Anonymous
August 13, 2016
Thanks TrveorAnonymous
September 02, 2016
Worked like a charm!Thanks a lot!Anonymous
September 20, 2016
Thanks a lot for sharing this which solved my issue.Anonymous
December 07, 2016
Thank you ... Was tired since morning solving this error.. Atlast came acrross to this solution.A very big thank you :pAnonymous
December 12, 2016
thank you broAnonymous
December 14, 2016
You're advise is still working two years later! Thank you!Anonymous
July 07, 2017
Even over three years later this solution is still useful. Thanks for posting it.Anonymous
November 02, 2017
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.Anonymous
January 18, 2019
Thanks. fixed my problem too.