Repeated 'Error: "toString()" failed' on launch.
See original GitHub issueDescription
As of yesterday, whenever I try to open Desktop, it tries to sync and then crashes.
Version
GitHub Desktop version: Unknown - (Latest I think?)
OS version: Windows 10 (Home), Version 1703, Build 15063.296
Steps to Reproduce
- Open GitHub Desktop…
- Wait for it to try and sync…
- Watch your hopes and dreams crumble.
I have two repos cloned in Desktop; https://github.com/rivermont/spidy and https://github.com/rivermont/instagram-graph.
It opens to spidy, and it appears that there is a push that it never manages to send before crashing.
Expected behaviour: Open GitHub Desktop without problems.
Actual behaviour: After opening, Desktop tries to sync and then crashes.
Reproduces how often: 100% of the time.
Attempted Debugging
- Force quit Desktop from Task Manager
- Restart computer.
- Push the commit really fast before it crashes.
- Run
Update.exe
from\AppData\Local\GitHubDesktop\
###Logs
Crash Report
Displayed in a nice red box with a single Quit
button:
GitHub Desktop encountered an uncaught exception, leaving it in an invalid state.
Error: “toString()” failed at Uint8Array.Buffer.toString (buffer.js:503:11) at StringDecoder.utf8Text [as text] (string_decoder.js:180:16) at StringDecoder.write (string_decoder.js:64:46) at readableAddChunk (_stream_readable.js:164:31) at Socket.Readable.push (_stream_readable.js:134:10) at Pipe.onread (net.js:551:20)
Crash Logs
Stolen from \AppData\Roaming\GitHub Desktop\logs\
:
2017-05-29T02:21:13.993Z - error: Uncaught exception on renderer process Error: “toString()” failed at Uint8Array.Buffer.toString (buffer.js:503:11) at StringDecoder.utf8Text [as text] (string_decoder.js:180:16) at StringDecoder.write (string_decoder.js:64:46) at readableAddChunk (_stream_readable.js:164:31) at Socket.Readable.push (_stream_readable.js:134:10) at Pipe.onread (net.js:551:20)
Issue Analytics
- State:
- Created 6 years ago
- Comments:20 (14 by maintainers)
Top GitHub Comments
So I’ve nailed this down to the file contents and how we handle this in the app.
To begin with, let’s just read the file in using
less
on Windows. We get to line 282 and it then starts spitting out garbage characters:Changing this up to use
git diff
you’ll see the same thing:For reference, on MacOS this problem file is detected as binary:
I’ve traced this behaviour through to
string_bytes.cc
.As this isn’t doing any encoding detection, and just failing quietly when it encounters the corrupted bytes, we have a couple of options:
@joshaber yeah, that’s the way I’m heading right now to make the crashes go away sooner 😛