question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Crash with SyntaxError: Unexpected token C in JSON at position 1644

See original GitHub issue

I saw a case very similar to https://github.com/microsoft/vscode-languageserver-node/issues/436

SyntaxError: Unexpected token C in JSON at position 1644
    at JSON.parse (<anonymous>)
    at StreamMessageReader.onData (node_modules/vscode-jsonrpc/lib/messageReader.js:182:29)
    at Socket.listen.readable.on (node_modules/vscode-jsonrpc/lib/messageReader.js:148:18)
    at Socket.emit (events.js:198:13)
    at addChunk (_stream_readable.js:288:12)
    at readableAddChunk (_stream_readable.js:269:11)
    at Socket.Readable.push (_stream_readable.js:224:10)
    at Pipe.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)

It looks like with certain characters the Emacs lsp-mode LSP client sends a bogus request. I’ve entered an issue with them to improve the situation https://github.com/emacs-lsp/lsp-mode/issues/1246

That issue contains repro steps and shows how to repro the example using a fork of the lsp-sample language server integrated into Emacs.

Could this repo be updated to more gracefully handle what looks to be a bogus request? That would help so that language servers don’t get killed because of an issue in an LSP client.

Please let me know other info/debug output I can provide to help.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
dbaeumercommented, Jul 6, 2020

The response has a wrong Content-Length set. This is why you end up with the additional “C”. It basically belongs to the header of the next message.

0reactions
vscodebot[bot]commented, Jul 13, 2020

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!

Read more comments on GitHub >

github_iconTop Results From Across the Web

SyntaxError: Unexpected token < in JSON at position 0
The error seems to be called in an infinite loop presumably as React continuously tries to connect to the server and eventually crashes...
Read more >
SyntaxError: Unexpected token T in JSON at position 0 - Drupal
Problem/Motivation When you try to launch a new site, this error fatal occurs: "SyntaxError: Unexpected token T in JSON at position 0"
Read more >
2 Server Error Message Reference - MySQL :: Developer Zone
Message: Table '%s' is marked as crashed and should be repaired ... Message: Invalid JSON text: "%s" at position %u in value for...
Read more >
Unexpected token in JSON at position 0 - YouTube
Uncaught (in promise) SyntaxError : Unexpected token in JSON at position 0.
Read more >
Bug #15794: Can not start Puma with Rails after bundle install
Don't forget to include the above Crash Report log file in bug reports. ... /Users/bacdo/.rvm/gems/ruby-2.4.3/gems/psych-3.1.0/lib/psych/json/ruby_events.rb ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found