Skip to content

Unexpected token � in JSON at position 0 #4866

Closed

Description

@vintagesucks

Description

When switching to or launching GitHub Desktop with a specific private repository I encounter the following error:

grafik

Version

  • GitHub Desktop: 1.2.2
  • Operating system: macOS High Sierra 10.13.4

Steps to Reproduce

Expected Behavior

No error.

Actual Behavior

Unexpected token � in JSON at position 0

Additional Information

Possibly related issues

#3399

Network Tab

Request header
GET /repos/***/***/pulls?state=open&per_page=100 HTTP/1.1
Host: api.github.com
Connection: keep-alive
accept: application/vnd.github.v3+json, application/json
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) GitHubDesktop/1.2.2 Chrome/59.0.3071.115 Electron/1.8.3 Safari/537.36
X-DevTools-Request-Id: 1018.75
authorization: token [token]
content-type: application/json
Accept-Encoding: gzip, deflate
Accept-Language: de
If-None-Match: "2569194fe5a3469e08a1ad7405b7dd5d"
Response header
HTTP/1.1 304 Not Modified
Server: GitHub.com
Date: Mon, 04 Jun 2018 10:16:26 GMT
Content-Type: application/octet-stream
Status: 304 Not Modified
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4989
X-RateLimit-Reset: 1528110195
Cache-Control: private, max-age=60, s-maxage=60
Vary: Accept, Authorization, Cookie, X-GitHub-OTP
ETag: "2569194fe5a3469e08a1ad7405b7dd5d"
Access-Control-Expose-Headers: ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
Access-Control-Allow-Origin: *
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
X-Frame-Options: deny
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
Content-Security-Policy: default-src 'none'
X-Runtime-rack: 0.074523
X-GitHub-Request-Id: D879:6D10:2B12656:50471FA:5B151174
Response
��Խ�

Logs

2018-06-04.desktop.production.log
2018-06-04T10:09:19.924Z - info: [ui] [AppStore] loading 17 repositories from store
2018-06-04T10:09:20.137Z - info: [ui] [AppStore] found account: vintagesucks (Nikolas Evers)
2018-06-04T10:09:24.638Z - info: [ui] Executing getRemotes: git remote -v (took 2.538s)
2018-06-04T10:09:24.639Z - info: [ui] Executing getBranches: git for-each-ref --format=%(refname)%00%(refname:short)%00%(upstream:short)%00%(objectname)%00%(author)%00%(committer)%00%(parent)%00%(symref)%00%(subject)%00%(body)%00%(trailers:unfold,only)%00%1F refs/heads refs/remotes (took 3.271s)
2018-06-04T10:09:27.561Z - info: [ui] launching: 1.2.2 (Mac OS 10.13.4)
2018-06-04T10:09:27.562Z - info: [ui] execPath: '/Applications/GitHub Desktop.app/Contents/Frameworks/GitHub Desktop Helper.app/Contents/MacOS/GitHub Desktop Helper'
2018-06-04T10:09:27.562Z - info: [ui] Executing getConfigValueInPath: git config -z trailer.separators (took 2.242s)
2018-06-04T10:09:38.132Z - info: [ui] Executing getBranches: git for-each-ref --format=%(refname)%00%(refname:short)%00%(upstream:short)%00%(objectname)%00%(author)%00%(committer)%00%(parent)%00%(symref)%00%(subject)%00%(body)%00%(trailers:unfold,only)%00%1F refs/heads refs/remotes (took 1.817s)
2018-06-04T10:09:38.136Z - info: [ui] Executing installGlobalLFSFilter: git lfs install --skip-repo (took 13.330s)
2018-06-04T10:09:38.136Z - info: [ui] Executing getRecentBranches: git log -g --no-abbrev-commit --pretty=oneline HEAD -n 2500 -- (took 18.196s)
2018-06-04T10:09:38.585Z - info: [ui] Executing getRecentBranches: git log -g --no-abbrev-commit --pretty=oneline HEAD -n 2500 -- (took 1.064s)
2018-06-04T10:09:38.586Z - info: [ui] Executing getBranches: git for-each-ref --format=%(refname)%00%(refname:short)%00%(upstream:short)%00%(objectname)%00%(author)%00%(committer)%00%(parent)%00%(symref)%00%(subject)%00%(body)%00%(trailers:unfold,only)%00%1F refs/heads refs/remotes (took 1.068s)
2018-06-04T10:09:38.590Z - info: [ui] Executing getStatus: git status --untracked-files=all --branch --porcelain=2 -z (took 1.103s)
2018-06-04T10:09:38.592Z - info: [ui] Executing getStatus: git status --untracked-files=all --branch --porcelain=2 -z (took 2.545s)
2018-06-04T10:09:38.593Z - info: [ui] Executing getStatus: git status --untracked-files=all --branch --porcelain=2 -z (took 19.542s)
2018-06-04T10:09:38.629Z - info: [ui] Executing getRecentBranches: git log -g --no-abbrev-commit --pretty=oneline HEAD -n 2500 -- (took 2.288s)
2018-06-04T10:11:26.488Z - warn: [ui] deserialize: invalid JSON found at 'https://api.github.com/repos/***/***/pulls?state=open&per_page=100' - status: 200, length: '(missing)' id: '(missing)'
SyntaxError: Unexpected token � in JSON at position 0
2018-06-04T10:11:26.489Z - warn: [ui] fetchPullRequests: failed for repository ***/***
SyntaxError: Unexpected token � in JSON at position 0
2018-06-04T10:11:26.489Z - warn: [ui] Error refreshing pull requests for '***'
SyntaxError: Unexpected token � in JSON at position 0
2018-06-04T10:11:30.692Z - info: [ui] Executing getBranches: git for-each-ref --format=%(refname)%00%(refname:short)%00%(upstream:short)%00%(objectname)%00%(author)%00%(committer)%00%(parent)%00%(symref)%00%(subject)%00%(body)%00%(trailers:unfold,only)%00%1F refs/heads refs/remotes (took 4.907s)
2018-06-04T10:11:30.697Z - info: [ui] Executing getBranches: git for-each-ref --format=%(refname)%00%(refname:short)%00%(upstream:short)%00%(objectname)%00%(author)%00%(committer)%00%(parent)%00%(symref)%00%(subject)%00%(body)%00%(trailers:unfold,only)%00%1F refs/heads refs/remotes (took 4.856s)
2018-06-04T10:12:05.534Z - info: [ui] Executing getRecentBranches: git log -g --no-abbrev-commit --pretty=oneline HEAD -n 2500 -- (took 39.705s)
2018-06-04T10:12:05.535Z - info: [ui] Executing getRecentBranches: git log -g --no-abbrev-commit --pretty=oneline HEAD -n 2500 -- (took 39.693s)
2018-06-04T10:12:23.828Z - info: [ui] Executing getStatus: git status --untracked-files=all --branch --porcelain=2 -z (took 57.992s)
2018-06-04T10:12:23.956Z - info: [ui] Executing getStatus: git status --untracked-files=all --branch --porcelain=2 -z (took 58.259s)
2018-06-04T10:12:54.182Z - info: [ui] [AppStore.withAuthenticatingUser] account found for repository: *** - vintagesucks (has token)

Activity

  1. added
    bug
    on Jun 6, 2018
  2. shiftkey commented on Jun 6, 2018

    @shiftkey
    Member

    @vintagesucks thanks for the report. I'm not sure why fetchAll (the root method that handles this network request) isn't correctly handling the 304 and trying to deserialize it:

    desktop/app/src/lib/api.ts

    Lines 467 to 476 in 0531a21

    const response = await this.request('GET', nextPath)
    if (response.status === HttpStatusCode.NotFound) {
    log.warn(`fetchAll: '${path}' returned a 404`)
    return []
    }
    if (response.status === HttpStatusCode.NotModified) {
    log.warn(`fetchAll: '${path}' returned a 304`)
    return []
    }

    But also this doesn't need to emit an error when it's already being logged. I've opened #4885 to kill off the unnecessary error here.

  3. self-assigned this
    on Jun 7, 2018
  4. shiftkey commented on Jun 7, 2018

    @shiftkey
    Member

    @vintagesucks are you able to sign out and in to your Desktop install again - there's a token in the network request that shouldn't have been made public.

  5. vintagesucks commented on Jun 7, 2018

    @vintagesucks
    Author

    @shiftkey Yes, I was able to do so 👍.

    I suppose the change of my display name and the name of a lot of my repositories (even repositories of an two organizations) - edit: repository settings, too 😒 - had something to do with me publishing the token here? 💩

    Questions:

    • Is it enough to remove GitHub Desktop from Authorized OAuth Apps to revoke the token?
    • Should I contact GitHub Support over this? I did
    • Can I somewhere review a non-truncated of version of my security history? I asked the Support team
  6. shiftkey commented on Jun 10, 2018

    @shiftkey
    Member

    Is it enough to remove GitHub Desktop from Authorized OAuth Apps to revoke the token?

    Yep, I recommend doing this and then signing in again to get a new token.

  7. locked as resolved and limited conversation to collaborators on Aug 14, 2018
  8. unlocked this conversation on Sep 27, 2018
  9. removed their assignment
    on Jun 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions