WebCord: Unexpected end of JSON input

Acknowledgements

  • I have checked that there is no other issue describing the same or similar problem that I currently have, regardless if it has been closed or open.

  • This bug affects Discord website.

  • This issue is confirmed to be reproduceable when WebCord is packaged on at least all three latest supported Electron major releases.

  • This issue is reproduceable in Chrome, Chromium or any Chromium-based browser, e.g Brave or Edge (please write in Additional Context which browser you have used if it is neither Chrome nor unmodified Chromium).

  • There are no fixes done to master which resolves this issue.

  • My issue describes one of the unstable and/or not fully implemented features.

  • I have found a workaround to mitigate or temporarily fix this issue in affected releases (please write it in Additional context section below).

Operating System / Platform

🐧️ Linux

Operating system architecture

x64 (64-bit Intel/AMD)

Electron version

Unable to boot, so cannot get version

Application version

4.1.1 and 4.1.0

Bug description

I have tried both WebCord 4.1.1 and 4.1.0 and the issue regardless. The application does not boot and it gives the following error

Unexpected end of JSON input

    at WinStateKeeper.#read(sources/code/main/modules/config.ts:163:17)
    at WinStateKeeper.get value [as value] (sources/main.modules/config.ts:183:80)
    at new Config (sources/code/main/modules/config.ts:217:48)
    at new WinStateKeeper (sources/code/main/modules/config.ts:300:5)
    at createMainWindow (sources/code/main/windows/main.ts:43:27)
    at App.main (sources/code/common/main.ts:370:40)

Restarting my machine does not help.

Additional context

There is a workaround thanks to @OwczarekGit. Deleting the file windowState in ~/.config/WebCord lets me start WebCord again and I do not see any immediate issues.

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 39
  • Comments: 38 (2 by maintainers)

Most upvoted comments

As a workaround You can remove windowState file in ~/.config/WebCord to make webcord start again.

@DigiOhhh Mentioning the workaround once is fine. Repeating the same workaround multiple times is spam, and more importantly does not resolve the issue faster. This is a primarily one-person project and said person is well aware of the issue and performing a rewrite (at the pace that life allows).

If you feel you cannot use the software, nothing prevents you from patching it yourself or using an alternative. I can’t believe I need to say this, but this is common etiquette that “me too” comments are not helpful on an issue tracker.

If you’re not contributing info to help fix the issue, maybe calm down with the comment spam on removing windowstate or config.json or the “it’s happening to me too!” Issue comments should be for actually moving the issue forward.

On that note, since there appears to be a rewrite in progress anyway (see the next branch of this repo), it doesn’t make sense to discuss this further until the rewrite is done since it might not even be an issue anymore.

I have the exact same issue, and like everyone said, removing the windowState.json file fixes it.

Workaround: After successfully opening WebCord, close it and remove write permission to the windowState.json file. That way you won’t have to remove it manually on every single boot.

Just to chime in in case someone installed it via flatpak. The windowState file is going to be at ~/.var/app/io.github.spacingbat3.webcord/config/WebCord/

From my experience, I need to do the following for the workaround:

  1. delete windowState.json
  2. reboot

For some reason, it doesn’t work for me unless I reboot.

You don’t have to reboot if you press the Abort button. If you press Ignore you’ll have to kill all webcord processes running in the background and after that WebCord will start.

If you’re not contributing info to help fix the issue, maybe calm down with the comment spam on removing windowstate or config.json or the “it’s happening to me too!” Issue comments should be for actually moving the issue forward.

On that note, since there appears to be a rewrite in progress anyway (see the next branch of this repo), it doesn’t make sense to discuss this further until the rewrite is done since it might not even be an issue anymore.

Yeah I plan to rewrite how Config works, mostly I think of implementing the class generic enough to work outside of Electron and WebCord (and maybe release it as a separate module?).

I also consider of polishing some of the modules like l10n and package.json to make them functional as separate modules published in NPM, these could be useful for anyone dealing with multiple package.json files (WebCord does that to generate a list of dependencies in About window and information about their licenses).

I wanted to do a rewrite as I feel unhappy with the current source code, I think nothing is alright and some stuff are too complex than they should be. Even the next is not fully what I think it is supposed to be, I probably want to make some stuff as actual separate modules – with TypeScript you should be able to choose what you really want to build in WebCord, so you can skip stuff like Electon Forge configuration if you don’t depend on it to package.

And I didn’t wanted to continue to develop 4.x.y as I feel I should start doing some stuff than keep planning. Contributing to code that will eventually be just deprecated seems rather unproductive. On the other hand, fixing some critical bugs just to make my client to work and release it on newer Electron version if supported without any breakages might keep my client at least alive, so I wonder if not to do that.


I remind that I still won’t be able to invest that much time through, so if I will work on rewrite, the development (or any kind of changes near WebCord) will be rather slow.

This just happened to me as well, there was a 0kb ~/.config/WebCord/windowState, deleting it fixed the issue.

For me, I had to remove config.json. (also an empty file)

For flatpak users: alias webcordbrokeagain='rm /home/gramdalf/.var/app/io.github.spacingbat3.webcord/config/WebCord/windowState'