Skip to content

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

@tomascapek

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.

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