Skip to content

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

Closed

Description

@tomascapek

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.

Activity

  1. gpocentek commented on Sep 27, 2017

    @gpocentek
    Contributor

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

  2. tomascapek commented on Sep 27, 2017

    @tomascapek
    Author

    Thank you very much!

  3. locked as resolved and limited conversation to collaborators on Nov 10, 2021
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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions