goreleaser/goreleaser · error
open merge request: %w
Error message
open merge request: %w
What it means
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.
Source
Thrown at internal/client/gitlab.go:851
// UseJobToken. Older versions of GitLab don't work with this, so we
// want to be specific
if ctx.Config.GitLabURLs.UseJobToken {
// We may be creating a new client with a non-CI_JOB_TOKEN, for
// things like Homebrew publishing. We can't use the
// CI_JOB_TOKEN there
return token == ciToken
}
return false
}
func (c *gitlabClient) OpenPullRequest(
ctx *context.Context,
base, head Repo,
title string,
draft bool,
) (string, error) {
if err := c.checkIsPrivateToken(); err != nil {
return "", fmt.Errorf("open merge request: %w", err)
}
var targetProjectID int64
if base.Owner != "" {
fullProjectPath := fmt.Sprintf("%s/%s", base.Owner, base.Name)
p, res, err := gitlabDo(ctx, func() (*gitlab.Project, *gitlab.Response, error) {
return c.client.Projects.GetProject(fullProjectPath, nil)
})
if err != nil {
log := log.WithField("project", fullProjectPath)
if res != nil {
log = log.WithField("statusCode", res.StatusCode)
}
log.WithError(err).Warn("error getting base project id")
return "", err
}
targetProjectID = p.ID
}View on GitHub (pinned to f5edd73956)
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
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at internal/client/gitlab.go:851 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of goreleaser/goreleaser@f5edd73956 (2026-09-05).
Data as JSON: /api/errors/71f73f2e4b477a3d.
Report an issue: GitHub.