Skip to content

GitlabHttpError(404) on merge request creation #329

Closed
@tomascapek

Description

@tomascapek

In my project, I updated this library to 1.0.2 and merge requests are no longer creating.

Code snippet is probably unnecessary, but here it is:

mr_data = {
    'source_branch': branch_name,
    'target_branch': self._branch,
    'title': data.title,
    'description': data.description,
    'assignee_id': self._get_assignee_id(),
    'remove_source_branch': True,
    'labels': f'{name}_{module_hash}',
}

and then just do something like this (assuming, that I created source_branch, which I do; more of this later)

gitlab.v4.objects.Project.mergerequests.create(mr_data)

This results in following exception:

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 170, in create
    server_data = self.gitlab.http_post(path, post_data=data, **kwargs)
  File "/home/tomas_capek/.virtualenvs/mrobot-latest/lib/python3.6/site-packages/gitlab/__init__.py", line 793, in http_post
   post_data=post_data, files=files, **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: 404: 404 Not found

So at first I thought, that there might be something wrong with my GitLab instance. So I did this, with all my arguments in mr_data.

curl --header "PRIVATE-TOKEN: 6PWsKdSfzpb-6zy8YUX4" "gitlab.somewhere/api/v4/projects/42/merge_requests" --data "assignee_id=29&description=desc& ... and so on "

Works properly, returns JSON as described in docs and merge request is created.

I tried to look into changes between 1.0.1 (my previously working) and 1.0.2 and I found no clue. Thanks for your time, I appreciate your hard work!

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