Skip to content

Cannot store pull requests for a repository that hasn't been inserted into the database #3568

Closed

Description

@mitar

Description

When I am adding a local cloned git repository from GitHub, I get the following error:

Cannot store pull requests for a repository that hasn't been inserted into the database!

Also, the repository gets listed under "Other" section of GitHub Destop.

Version

I am using a compiled GitHub Desktop on Linux from master branch.

Activity

  1. added
    bug
    more-info-needed
    on Dec 11, 2017
  2. joshaber commented on Dec 11, 2017

    @joshaber
    Contributor

    That's interesting! Could you provide the exact steps you took to get this? Does it happen every time you add a repository?

  3. mitar commented on Dec 11, 2017

    @mitar
    Author

    Yes, it happens every time.

    I do not see any special steps to do. Literally just "add a local repository", I select it and confirm, and this error shows.

  4. joshaber commented on Dec 11, 2017

    @joshaber
    Contributor

    I haven't been able to reproduce this on Mac. May be Linux-specific somehow.

  5. mitar commented on Dec 11, 2017

    @mitar
    Author

    Not sure what is this even try to do? Is it trying to fetch something from GitHub API? Does it even have access to do so?

    Oh, this is it. This is happening only for private repos. Now that I think, I do not remember GitHub Desktop ever asking me for any authentication to login or something.

  6. mitar commented on Dec 11, 2017

    @mitar
    Author

    Is it maybe a problem that I copied github_rsa and github_rsa.pub from my old computer?

  7. shiftkey commented on Dec 11, 2017

    @shiftkey
    Member

    Oh, this is it. This is happening only for private repos. Now that I think, I do not remember GitHub Desktop ever asking me for any authentication to login or something.

    I think this is related to how we're handling remotes. Is it configured with a HTTPS or SSH remote?

    The credential provider inside Desktop uses GIT_ASKPASS to handle credentials - if you can't push or pull to your private repository and it's HTTPS ensure you are signed in. I also think need you to sign in for the API lookups around pull requests.

    @iAmWillShepherd any other thoughts on why it might end up in this state?

  8. mitar commented on Dec 11, 2017

    @mitar
    Author

    They are SSH remotes. I do not have GIT_ASKPASS (environment variable, I presume) set.

  9. shiftkey commented on Dec 11, 2017

    @shiftkey
    Member

    @mitar GIT_ASKPASS is just how Desktop authenticates for HTTPS remotes (this is ignored for SSH remotes).

    Are you signed into the app? I think that's the missing piece, but doesn't explain why it's trying to resolve pull requests when you're not signed in (it shouldn't care).

  10. mitar commented on Dec 11, 2017

    @mitar
    Author

    I see quite some errors in the error log. Some seems unrelated.

    2017-12-11T09:48:27.075Z - info: [ui] [AppStore] adding repository at /<redacted>/servers to store
    2017-12-11T09:48:27.439Z - warn: [ui] fetchRepository: '<redacted>/servers' returned a 404
    2017-12-11T09:48:27.495Z - warn: [ui] Unable to fetch issues for <redacted>/servers
    Error: Cannot get issues for a repository that hasn't been inserted into the database!
        at Object.n [as fatalError] (/home/mitar/webpack:/external "path":1:1)
        at t.IssuesStore.getLatestUpdatedAt (/home/mitar/webpack:/app/src/lib/stores/issues-store.ts:29:24)
        at t.IssuesStore.fetchIssues (/home/mitar/webpack:/app/src/lib/stores/issues-store.ts:66:5)
        at te._updateIssues (/home/mitar/webpack:/app/src/lib/stores/app-store.ts:825:6)
        at te._selectRepository (/home/mitar/webpack:/app/src/lib/stores/app-store.ts:781:11)
        at t.Dispatcher.selectRepository (/home/mitar/webpack:/app/src/lib/dispatcher/dispatcher.ts:166:4)
        at addRepository (/home/mitar/webpack:/app/src/ui/add-repository/add-existing-repository.tsx:185:3)
        at <anonymous>
    2017-12-11T09:48:27.620Z - warn: [ui] fetchAll: 'repos/<redacted>/servers/pulls?state=open' returned a 404
    2017-12-11T09:48:27.621Z - warn: [ui] Error refreshing pull requests for 'servers'
    Error: Cannot store pull requests for a repository that hasn't been inserted into the database!
        at Object.n [as fatalError] (/home/mitar/webpack:/external "path":1:1)
        at t.PullRequestStore.writePRs (/home/mitar/webpack:/app/src/lib/stores/pull-request-store.ts:179:17)
        at t.PullRequestStore.refreshPullRequests (/home/mitar/webpack:/app/src/lib/stores/pull-request-store.ts:51:7)
        at <anonymous>
    2017-12-11T09:48:27.753Z - warn: [ui] fetchRepository: '<redacted>/servers' returned a 404
    2017-12-11T09:48:27.810Z - warn: [ui] fetchCommit: 'repos/<redacted>/servers/commits/<redacted>' returned a 404
    2017-12-11T09:48:27.812Z - warn: [ui] fetchCommit: 'repos/<redacted>/servers/commits/<redacted>' returned a 404
    2017-12-11T09:48:27.813Z - warn: [ui] fetchCommit: 'repos/<redacted>/servers/commits/<redacted>' returned a 404
    2017-12-11T09:56:16.897Z - error: [ui] Could not load old contents for syntax highlighting
    Error: Git returned an unexpected exit code '128' which should be handled by the caller.'
        at ChildProcess.s.on (/home/mitar/webpack:/app/src/lib/git/spawn.ts:88:15)
        at emitTwo (events.js:106:13)
        at ChildProcess.emit (events.js:194:7)
        at maybeClose (internal/child_process.js:899:16)
        at Socket.<anonymous> (internal/child_process.js:342:11)
        at emitOne (events.js:96:13)
        at Socket.emit (events.js:191:7)
        at Pipe._handle.close [as _onclose] (net.js:510:12)
    2017-12-11T09:56:16.900Z - error: [ui] Could not load new contents for syntax highlighting
    Error: EISDIR: illegal operation on a directory, read
    2017-12-11T09:58:27.874Z - warn: [ui] fetchAll: 'repos/<redacted>/servers/pulls?state=open' returned a 404
    2017-12-11T09:58:27.879Z - warn: [ui] Error refreshing pull requests for 'servers'
    Error: Cannot store pull requests for a repository that hasn't been inserted into the database!
        at Object.n [as fatalError] (/home/mitar/webpack:/external "path":1:1)
        at t.PullRequestStore.writePRs (/home/mitar/webpack:/app/src/lib/stores/pull-request-store.ts:179:17)
        at t.PullRequestStore.refreshPullRequests (/home/mitar/webpack:/app/src/lib/stores/pull-request-store.ts:51:7)
        at <anonymous>
    2017-12-11T10:05:00.618Z - error: [ui] Could not load old contents for syntax highlighting
    Error: Git returned an unexpected exit code '128' which should be handled by the caller.'
        at ChildProcess.s.on (/home/mitar/webpack:/app/src/lib/git/spawn.ts:88:15)
        at emitTwo (events.js:106:13)
        at ChildProcess.emit (events.js:194:7)
        at maybeClose (internal/child_process.js:899:16)
        at Socket.<anonymous> (internal/child_process.js:342:11)
        at emitOne (events.js:96:13)
        at Socket.emit (events.js:191:7)
        at Pipe._handle.close [as _onclose] (net.js:510:12)
    2017-12-11T10:05:00.623Z - error: [ui] Could not load new contents for syntax highlighting
    Error: EISDIR: illegal operation on a directory, read
    2017-12-11T10:05:12.666Z - error: [ui] Could not load old contents for syntax highlighting
    Error: Git returned an unexpected exit code '128' which should be handled by the caller.'
        at ChildProcess.s.on (/home/mitar/webpack:/app/src/lib/git/spawn.ts:88:15)
        at emitTwo (events.js:106:13)
        at ChildProcess.emit (events.js:194:7)
        at maybeClose (internal/child_process.js:899:16)
        at Socket.<anonymous> (internal/child_process.js:342:11)
        at emitOne (events.js:96:13)
        at Socket.emit (events.js:191:7)
        at Pipe._handle.close [as _onclose] (net.js:510:12)
    2017-12-11T10:05:12.674Z - error: [ui] Could not load new contents for syntax highlighting
    Error: EISDIR: illegal operation on a directory, read
    
  11. mitar commented on Dec 11, 2017

    @mitar
    Author

    Are you signed into the app?

    In "Options" it looks like I am (I see my account and avatar).

  12. added
    linux
    on Dec 11, 2017
  13. shiftkey commented on Dec 11, 2017

    @shiftkey
    Member

    In "Options" it looks like I am (I see my account and avatar).

    Ok cool, that explains why it's trying to resolve pull requests. Digging into that log file, I can see some interesting groups of issues:

    2017-12-11T09:48:27.495Z - warn: [ui] Unable to fetch issues for <redacted>/servers
    Error: Cannot get issues for a repository that hasn't been inserted into the database!
    ...
    2017-12-11T09:48:27.621Z - warn: [ui] Error refreshing pull requests for 'servers'
    Error: Cannot store pull requests for a repository that hasn't been inserted into the database!
    

    If the repositories aren't being inserted correctly into the IndexedDB databases that Electron offers for apps, that would explain these errors. Does the application forget your tracked repositories when you restart it? We should have some tracing here but I'm not sure how detailed it is.

    2017-12-11T09:56:16.900Z - error: [ui] Could not load new contents for syntax highlighting
    Error: EISDIR: illegal operation on a directory, read
    ... 
    2017-12-11T10:05:00.618Z - error: [ui] Could not load old contents for syntax highlighting
    Error: Git returned an unexpected exit code '128' which should be handled by the caller.'
    

    I tested this out on Fedora 16.04 and didn't spot any issues. I'm not going to focus on this for now, as the inconsistent errors here look to be environmental.

    I am using a compiled GitHub Desktop on Linux from master branch.

    It's not clear to me whether you are running this in development mode yarn start or production mode yarn build:prod && yarn start:prod. Also, it's not clear which distribution of Linux you are running here.

  14. mitar commented on Dec 11, 2017

    @mitar
    Author

    Does the application forget your tracked repositories when you restart it?

    No. If I restart the app it loads the list of the repositories in the sidebar as it was before.

    I'm not going to focus on this for now, as the inconsistent errors here look to be environmental.

    I have not seen in UI any issues with diffing. So I agree we leave this be for now.

    It's not clear to me whether you are running this in development mode yarn start or production mode yarn build:prod && yarn start:prod. Also, it's not clear which distribution of Linux you are running here.

    I made a production webpack package and I am using that. I could try running it in some other way if it would be helpful. I am using Linux Ubuntu 17.10.

    What about 404 errors?

  15. iAmWillShepherd commented on Dec 11, 2017

    @iAmWillShepherd
    Contributor

    @shiftkey, I've had these issues before, but that's only while in the middle of development.

    The way I got into this state was to modify one of the databases and reload the app. So one thing I'd recommend is to try deleting all the databases in the app. If after doing that and reloading the app, the issue still persists, we can rule that out as a possible cause.

    @mitar , can you give this a shot? Just open Dev Tools located under the View top bar menu and go to Application -> IndexedDB -> [databases] and delete each one, then delete local storage and restart the app.

    2017-12-11_14-51-56 1

  16. shiftkey commented on Dec 11, 2017

    @shiftkey
    Member

    As an aside:

    I have not seen in UI any issues with diffing. So I agree we leave this be for now.

    That error looks to be with syntax highlighting, so it should be degrading to the plain diff in this case.

  17. iAmWillShepherd commented on Dec 11, 2017

    @iAmWillShepherd
    Contributor

    I made a production webpack package and I am using that. I could try running it in some other way if it would be helpful. I am using Linux Ubuntu 17.10.

    Could you post your webpack config, please?

  18. mitar commented on Dec 11, 2017

    @mitar
    Author

    Sorry. I got confused here. I had in mind appimage, not webpack. But now I realized this is not what I am really running at the moment (I tried multiple things and it didn't work for me). In fact I made a Debian package and installed that and I am using it. Same as what I described here.

    So there is no special changes to the config. I just built it and installed it.

  19. shiftkey commented on Dec 12, 2017

    @shiftkey
    Member

    @mitar can you try the workaround that @iAmWillShepherd suggested about removing the databases and then try re-adding the repository? If that works we can then look into the trickier issues.

  20. removed
    bug
    on Dec 12, 2017
  21. shiftkey commented on Dec 14, 2017

    @shiftkey
    Member

    I'm going to recommend downloading the release candidate I link to in #1525 (comment) and validating the issue is reproducible there. If it is, please resubmit this (with repro steps and details) to my fork.

  22. locked as resolved and limited conversation to collaborators on Jul 18, 2018
  23. unlocked this conversation on Sep 27, 2018
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

    linuxmore-info-needed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions