Skip to content

ListGroupMergeRequests Error: json: cannot unmarshal object into Go struct field BasicMergeRequest.labels of type string

Hi there!

Following the conversation on this issue, i'm creating this to investigate this error (maybe a regression?).

When running the following code to get the merge requests of a group:

scope := "all"
state := "merged"
withLabelsDetails := true
firstDayOfWeek := utils.GetFirstDayOfWeek()
branch := "main"

mergeRequestList, _, err := r.gitlabClient.MergeRequests.ListGroupMergeRequests(
			r.config.GitlabGroupID,
			&gitlab.ListGroupMergeRequestsOptions{
				UpdatedAfter:      &firstDayOfWeek,
				Scope:             &scope,
				TargetBranch:      &branch,
				State:             &state,
				WithLabelsDetails: &withLabelsDetails,
				ListOptions: gitlab.ListOptions{
					Page:    1,
					PerPage: 100,
				},
			},
		)

I'm getting this error:

json: cannot unmarshal object into Go struct field BasicMergeRequest.labels of type string

I'm using this version:

gitlab.com/gitlab-org/api/client-go v0.141.1 // indirect
Edited by 🤖 GitLab Bot 🤖
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information