Skip to content

GitlabHttpError(400) when making changes to existing merge request #325

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

Closed
tomascapek opened this issue Sep 26, 2017 · 2 comments
Closed
Labels

Comments

@tomascapek
Copy link

I have obtained object of gitlab.v4.objects.ProjectMergeRequest and I am trying to do some changes in given merge request - for instance, I am trying to close it:
mr = gitlab.v4.objects.Project.mergerequests.list()[0]

mr.state_event = 'close'
mr.save()

But at save() I got following exception:

Traceback (most recent call last):
  File "/home/tomas_capek/.virtualenvs/mrobot-latest/lib/python3.6/site-packages/gitlab/exceptions.py", line 239, in wrapped_f
    return f(*args, **kwargs)
  File "/home/tomas_capek/.virtualenvs/mrobot-latest/lib/python3.6/site-packages/gitlab/mixins.py", line 222, in update
    return self.gitlab.http_put(path, post_data=data, **kwargs)
  File "/home/tomas_capek/.virtualenvs/mrobot-latest/lib/python3.6/site-packages/gitlab/__init__.py", line 821, in http_put
    post_data=post_data, **kwargs)
  File "/home/tomas_capek/.virtualenvs/mrobot-latest/lib/python3.6/site-packages/gitlab/__init__.py", line 700, in http_request
    response_body=result.content)
gitlab.exceptions.GitlabHttpError: 400: b'{"error":"labels is invalid"}'

This code worked flawlessly with version 1.0.0.

Since this problem is related to labels (and according to the change log there was some changes in those in the latest release), on given merge request, there is only one label present. I haven't tried this on merge request with multiple or none labels, because I discovered it in a production environment, by an accident.

@gpocentek
Copy link
Contributor

Thanks for the report @tomascapek , I messed up in commit e09581f. Fix is coming up, I'll release 1.0.2 very soon.

@tomascapek
Copy link
Author

Thank you very much!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants