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

json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 29792 column 25 (char 877052) #144

Closed
0mp opened this issue Oct 17, 2021 · 2 comments

Comments

@0mp
Copy link
Contributor

0mp commented Oct 17, 2021

Hi, I think I hit a bug in how scli is parsing the JSON string from signal-cli:

$ scli
Traceback (most recent call last):
  File "/usr/local/share/scli/scli", line 4438, in <module>
    main()
  File "/usr/local/share/scli/scli", line 4423, in main
    coord = Coordinate()
  File "/usr/local/share/scli/scli", line 3789, in __init__
    self._chats_data = ChatsData(cfg.save_history)
  File "/usr/local/share/scli/scli", line 1618, in __init__
    self._load_history()
  File "/usr/local/share/scli/scli", line 1655, in _load_history
    history = json.load(history_file)
  File "/usr/local/lib/python3.8/json/__init__.py", line 293, in load
    return loads(fp.read(),
  File "/usr/local/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/lib/python3.8/json/decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 29792 column 25 (char 877052)

Versions I run:

  • scli-0.6.4_2 (overview, git)
  • signal-cli-0.9.0
  • libsignal-client-0.9.6
  • python38-3.8.12

Please let me know if there is anything I can do to help debugging this issue.

Cheers!

@0mp
Copy link
Contributor Author

0mp commented Oct 17, 2021

Hmm, so it turns out it is not really a bug in scli. My history file was corrupted. Here's the end of the file:

    {
      "source": "+123456789",
      "sourceName": "XYZ",
      "sourceDevice": 1,
      "timestamp": 1628935184419,
      "syncMessage": {
        "sentMessage": {

Once I removed this broken object and closed the "envelopes" array and the outermost object (i.e., ]}) scli started just fine.

I'm not sure if that's a bug. Sure, scli could suggest the user to look there but I'm not sure if that's a priority.

Cheers!

@0mp 0mp closed this as completed Oct 17, 2021
@exquo
Copy link
Collaborator

exquo commented Oct 18, 2021

There are a few commits in master to address just this kind of problem (ref. #112 (comment)), but unfortunately they are not in a point release yet. I'll make a new release once everything is tested with the fresh signal-cli v0.9.1.


EDIT: sorry, missed your second message when writing this comment; so the stuff below you already knew:

Looks like the history file got corrupted :(. Could have been a result of an anomalous termination (e.g. receiving SIGKILL).

You can try editing the history file manually to make it a valid JSON file - to keep whatever has been saved during scli's last shutdown (the completeness is determined by luck). If you don't mind losing it, you can just delete the history file.

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

2 participants