buttercup-desktop icon indicating copy to clipboard operation
buttercup-desktop copied to clipboard

JSON parse error on config read

Open cajuuh opened this issue 3 years ago • 8 comments

Buttercup was working fine until yesterday, when it stops opening the UI, now i can use only for the extensions, i tried to open it from powershell and here is my output:

[INF] 02:45:10: Application starting                                                                      ❮  
[INF] 02:45:10: Protocol already registered: buttercup
[INF] 02:45:10: Application ready
[INF] 02:45:10: Application session started: 2021-12-02T02:45:10.079Z
[INF] 02:45:10: Logs location: C:\Users\pedro\AppData\Local\Buttercup-nodejs\Log\buttercup-desktop.log
[ERR] 02:45:10: SyntaxError: Unexpected token  in JSON at position 0
at undefined                                                                                                            
at parse                                                                                                                
at <anonymous>  resources/app.asar/build/main/library/FileStorage.js:66  return JSON.parse(data);                       
at next                                                                                                                 
at fulfilled    resources/app.asar/build/main/library/FileStorage.js:5   function fulfilled(value) { try { step(generator.next(value)); } catch (e) { re…

That's a path related issue.

cajuuh avatar Dec 02 '21 02:12 cajuuh

Same issue in MacOS Catalina

image

alfreedom avatar Dec 02 '21 21:12 alfreedom

The solution for me was add {} to the config file

echo "{}" > ~/Library/Preferences/Buttercup-nodejs/desktop.config.json

alfreedom avatar Dec 09 '21 21:12 alfreedom

Same issue here on Windows. I have to delete the file in C:\Users\ username \Roaming\Buttercup-nodejs\Config\desktop.config.json to fix Buttercup.

toxis avatar Dec 20 '21 09:12 toxis

Has anyone taken a look at what the file looks like before deleting/changing it? Is it empty/incomplete/corrupted? As I've never seen this issue I have no idea what Buttercup might be doing for the file to end up this way.

perry-mitchell avatar Dec 21 '21 20:12 perry-mitchell

@perry-mitchell The files was empty, so an error occurs when the app tries to parse an empty json file

alfreedom avatar Dec 21 '21 21:12 alfreedom

Hopefully someone can debug this on windows at some point, as I've not been able to reproduce it. We use standard Node calls to write the config, so I don't know what could cause this.

perry-mitchell avatar Dec 23 '21 13:12 perry-mitchell

Same error for me on Zorin OS 16.3, fixed by the same solution than @alfreedom

The solution for me was add {} to the config file

echo "{}" > ~/Library/Preferences/Buttercup-nodejs/desktop.config.json

pippo571 avatar Oct 22 '23 22:10 pippo571

@pippo571 Any chance you might check your logs for before this issue happened? Anything there indicating an error when writing the config file?

EDIT: It might be an idea for us to write a verification call to the config after updating it, to ensure it was written correctly.

perry-mitchell avatar Oct 23 '23 13:10 perry-mitchell