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

GitLabError: 404 Branch Not Found #2614

Closed
Jamesking56 opened this issue Oct 8, 2018 · 11 comments
Closed

GitLabError: 404 Branch Not Found #2614

Jamesking56 opened this issue Oct 8, 2018 · 11 comments
Labels
platform:gitlab GitLab Platform priority-4-low Low priority, unlikely to be done unless it becomes important to more people type:bug Bug fix of existing functionality

Comments

@Jamesking56
Copy link
Contributor

Jamesking56 commented Oct 8, 2018

What Renovate type are you using?
Renovate Docker run via GitLab CI

Describe the bug
If you delete a branch in GitLab, it causes an error in renovate log:

WARN: Error getting PR branch (repository=<project>, dependencies=vue-router, branch=renovate/vue-router-3.x)
       "err": {
         "name": "GitLabError",
         "host": "gitlab.com",
         "hostname": "gitlab.com",
         "method": "GET",
         "path": "/api/v4/projects/<project>/repository/branches/renovate%2Fvue-router-3.x",
         "protocol": "https:",
         "url": "https://gitlab.com/api/v4/projects/<project>/repository/branches/renovate%2Fvue-router-3.x",
         "statusCode": 404,
         "statusMessage": "Not Found",
         "headers": {
           "server": "nginx",
           "date": "Mon, 08 Oct 2018 09:19:59 GMT",
           "content-type": "application/json",
           "content-length": "34",
           "connection": "close",
           "cache-control": "no-cache",
           "vary": "Origin",
           "x-content-type-options": "nosniff",
           "x-frame-options": "SAMEORIGIN",
           "x-request-id": "ba0f7a0a-b8d0-43e7-91ec-4550b58fc765",
           "x-runtime": "0.028301",
           "ratelimit-limit": "600",
           "ratelimit-observed": "3",
           "ratelimit-remaining": "597",
           "ratelimit-reset": "1538990459",
           "ratelimit-resettime": "Tue, 08 Oct 2018 09:20:59 GMT"
         },
         "body": {"message": "404 Branch Not Found"},
         "message": "404 Branch Not Found (404)",
         "stack": "GitLabError: 404 Branch Not Found (404)\n    at stream.catch.then.data (/usr/src/app/node_modules/gl-got/node_modules/got/index.js:182:13)\n    at <anonymous>\n    at process._tickCallback (internal/process/next_tick.js:189:7)"
       }

This causes the script to return a failure (return code 1)

To Reproduce
Steps to reproduce the behavior:

  1. Get Renovate to make an MR
  2. Close the MR and Delete the branch
  3. Re-run renovate

Expected behavior
I would expect renovate to close the MR (if it hasn't been closed) and ignore that update.

@rarkins
Copy link
Collaborator

rarkins commented Oct 8, 2018

Doesn’t GitLab automatically close PRs when the associated branch disappears?

@Jamesking56
Copy link
Contributor Author

@rarkins I don't think so no

@rarkins
Copy link
Collaborator

rarkins commented Oct 8, 2018

That's really strange then. A while back they changed behaviour which meant Renovate's own PRs got closed when it needs to delete a branch before pushing again. I don't understand how/why the behaviour would be different in this case. In short though: don't go deleting the branches unless you plan to close the MR too :)

@rarkins rarkins added type:bug Bug fix of existing functionality ready priority-4-low Low priority, unlikely to be done unless it becomes important to more people platform:gitlab GitLab Platform labels Oct 8, 2018
@Jamesking56
Copy link
Contributor Author

@rarkins Yeah I realise that now, the issue I now have is how do I stop it warning me on every run?

@rarkins
Copy link
Collaborator

rarkins commented Oct 8, 2018

@Jamesking56 if the problem is because a MR's branch was deleted and the MR remains open, can you just manually close or delete the MR?

@Jamesking56
Copy link
Contributor Author

@rarkins The MR is closed. I closed the MR and clicked to delete the branch and now this warning always appears.

@rarkins
Copy link
Collaborator

rarkins commented Oct 8, 2018

@Jamesking56 in that case could you update/correct the reproduction steps? What you describe now doesn't match with the steps in the bug report.

@Jamesking56
Copy link
Contributor Author

@rarkins updated

@rarkins
Copy link
Collaborator

rarkins commented Oct 8, 2018

Looking at the source code, I think this is a harmless situation (a closed PR is retrieve but its branch does not exist) so I am adding a fix to skip any logger warning in such cases.

@Jamesking56
Copy link
Contributor Author

Thanks so much @rarkins

@rarkins rarkins closed this as completed in 44d84e5 Oct 8, 2018
@rarkins rarkins removed the ready label Oct 8, 2018
@renovate-bot
Copy link
Collaborator

🎉 This issue has been resolved in version 13.99.10 🎉

The release is available on:

Your semantic-release bot 📦🚀

corecanarias pushed a commit to corecanarias/renovate that referenced this issue Oct 24, 2018
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
platform:gitlab GitLab Platform priority-4-low Low priority, unlikely to be done unless it becomes important to more people type:bug Bug fix of existing functionality
Projects
None yet
Development

No branches or pull requests

3 participants