Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting the following error whenever I am trying to execute any cf command. #1199

Closed
agishita opened this issue Aug 10, 2017 · 12 comments
Closed

Comments

@agishita
Copy link

agishita commented Aug 10, 2017

←[31;1mFAILED←[0m
Error read/writing config: unexpected end of JSON input

@cf-gitbot
Copy link

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/150122849

The labels on this github issue will be updated when the story is started.

@dkoper
Copy link

dkoper commented Aug 10, 2017

Please delete your $HOME/.cf/config.json and target your endpoint & log in again (cf login -a ...).
There are rare cases that we haven't all been able to address yet where this file (which the CLI uses to store your targeted endpoint, space, etc.) can get corrupted.

@agishita
Copy link
Author

agishita commented Aug 10, 2017

Thanks for the response.. @dkoper
But I don't see .cf folder anywhere. Can u help me locate this folder?

@dkoper
Copy link

dkoper commented Aug 10, 2017

What platform are you on?
It defaults to ~/.cf, $CF_HOME/.cf, $HOME/.cf or e.g. c:\users\you\.cf.

@agishita
Copy link
Author

agishita commented Aug 10, 2017

I am working on Windows-7 64-bit.
I am unable to see it in the users directory.

I also tried re-installing cloudfoundary, still the can't see the folder

@dkoper
Copy link

dkoper commented Aug 10, 2017

What do dir %HOME%\.cf and dir %HOMEDRIVE%%HOMEPATH%\.cf return?

@agishita
Copy link
Author

I am in c:\users\you\ directory
then ran the two commands as you have mentioned above

dir %HOME%.cf
The system cannot find the file specified.

dir %HOMEDRIVE%%HOMEPATH%.cf
Volume in drive C is Windows
Volume Serial Number is 78D6-ABB2

Directory of C:\Users\212612243.cf

08/10/2017 10:21 AM 0 config.json
1 File(s) 0 bytes
0 Dir(s) 200,279,760,896 bytes free

@dkoper
Copy link

dkoper commented Aug 10, 2017

Do a del %HOMEDRIVE%%HOMEPATH%\.cf\config.json and you should be able to use cf login and start again.

@agishita
Copy link
Author

This works :)
Can u please explain what was the issue?

@dkoper
Copy link

dkoper commented Aug 10, 2017

Your config file got truncated to 0 bytes, causing the CLI to fail to read it's contents (an empty file is not valid JSON). We've seen the file getting truncated in a number of timing related circumstances:

  • CLI run simultaneously in different terminals, where both processes try to save to the same file
  • Aborting the CLI (with ctrl-c) while it was writing to the file

Glad to hear you got it working again!

Regards,
Dies Koper CF CLI PM
There may be other conditions as well that we haven't identified yet.

@dkoper
Copy link

dkoper commented Aug 18, 2017

FYI, we have made the window for this issue to occur much smaller in cf CLI 6.29.1. Thanks again for the report.
https://github.com/cloudfoundry/cli#downloads

Cheers,
Dies Koper
CF CLI PM

@ilovejs
Copy link

ilovejs commented May 17, 2019

Do a del %HOMEDRIVE%%HOMEPATH%\.cf\config.json and you should be able to use cf login and start again.

works in Command Prompt not in Powershell i believe.

I ended up rewriting Register HOMEPATH, HOMESHARE variables to sort out Active Directory...
WIndow home location is called Documents, which can be located in a network drive admin won't have mkdir .cf permission...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants