{"record":{"id":"71f73f2e4b477a3d","repo":"goreleaser/goreleaser","slug":"open-merge-request-w","errorCode":null,"errorMessage":"open merge request: %w","messagePattern":"open merge request: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/client/gitlab.go","lineNumber":851,"sourceCode":"\t// UseJobToken. Older versions of GitLab don't work with this, so we\n\t// want to be specific\n\tif ctx.Config.GitLabURLs.UseJobToken {\n\t\t// We may be creating a new client with a non-CI_JOB_TOKEN, for\n\t\t// things like Homebrew publishing. We can't use the\n\t\t// CI_JOB_TOKEN there\n\t\treturn token == ciToken\n\t}\n\treturn false\n}\n\nfunc (c *gitlabClient) OpenPullRequest(\n\tctx *context.Context,\n\tbase, head Repo,\n\ttitle string,\n\tdraft bool,\n) (string, error) {\n\tif err := c.checkIsPrivateToken(); err != nil {\n\t\treturn \"\", fmt.Errorf(\"open merge request: %w\", err)\n\t}\n\tvar targetProjectID int64\n\tif base.Owner != \"\" {\n\t\tfullProjectPath := fmt.Sprintf(\"%s/%s\", base.Owner, base.Name)\n\n\t\tp, res, err := gitlabDo(ctx, func() (*gitlab.Project, *gitlab.Response, error) {\n\t\t\treturn c.client.Projects.GetProject(fullProjectPath, nil)\n\t\t})\n\t\tif err != nil {\n\t\t\tlog := log.WithField(\"project\", fullProjectPath)\n\t\t\tif res != nil {\n\t\t\t\tlog = log.WithField(\"statusCode\", res.StatusCode)\n\t\t\t}\n\t\t\tlog.WithError(err).Warn(\"error getting base project id\")\n\t\t\treturn \"\", err\n\t\t}\n\t\ttargetProjectID = p.ID\n\t}","sourceCodeStart":833,"sourceCodeEnd":869,"githubUrl":"https://github.com/goreleaser/goreleaser/blob/f5edd7395693c0c6b501dc722d445d2e86af854d/internal/client/gitlab.go#L833-L869","documentation":"Wrapped error in gitlabClient.OpenPullRequest: the pre-flight checkIsPrivateToken call failed. Because GitLab requires a non-job token for merge-request creation, this fires when CI_JOB_TOKEN is in use and gitlab_urls.use_job_token is enabled — the wrapped error explains which condition failed.","triggerScenarios":"Thrown at internal/client/gitlab.go:851 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a private access token instead of a CI job token when opening merge requests from publishing steps","Only set use_job_token when the flow actually runs with CI_JOB_TOKEN; disable it for Homebrew-style publishing","Run OpenPullRequest in a context where the configured token equals the CI token if job-token mode is intended"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f5edd7395693c0c6b501dc722d445d2e86af854d","analyzedAt":"2026-09-05T09:57:18.807Z","contentChangedAt":"2026-09-05T09:57:18.807Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}