goreleaser/goreleaser · error

'server' is a required config key

Error message

'server' is a required config key

What it means

The discourse announce pipe validates its config and returns this error when announce.discourse.server is empty. The server (forum base URL) is required to post the announcement, so the pipe fails fast instead of making a request to an invalid endpoint.

Source

Thrown at internal/pipe/discourse/discourse.go:64

	}

	return nil
}

func (p Pipe) Announce(ctx *context.Context) error {
	title, err := tmpl.New(ctx).Apply(ctx.Config.Announce.Discourse.TitleTemplate)
	if err != nil {
		return err
	}

	msg, err := tmpl.New(ctx).Apply(ctx.Config.Announce.Discourse.MessageTemplate)
	if err != nil {
		return err
	}

	// Make 'server' a required config field.
	if ctx.Config.Announce.Discourse.Server == "" {
		return errors.New("'server' is a required config key")
	}

	// Make 'category_id' a required config field.
	if ctx.Config.Announce.Discourse.CategoryID == 0 {
		return errors.New("'category_id' is a required config key")
	}

	cfg, err := env.ParseAs[Config]()
	if err != nil {
		return err
	}

	pr := &postsRequest{
		Title:    title,
		Raw:      msg,
		Category: ctx.Config.Announce.Discourse.CategoryID,
	}

View on GitHub (pinned to f5edd73956)

Solutions

  1. Set announce.discourse.server in .goreleaser.yaml to your forum URL
  2. Ensure any environment variable used for the server value is exported in CI
  3. Remove/comment the discourse announce block if you don't use Discourse

Example fix

// before
announce:
  discourse:
    category_id: 5
// after
announce:
  discourse:
    server: https://forum.example.com
    category_id: 5
Defensive patterns

Strategy: validation

Validate before calling

if ctx.Config.Announce.Discourse.Server == "" {
	log.Fatal("announce.discourse.server must be set")
}

Try / catch

if err := pipe.Announce(ctx); err != nil && strings.Contains(err.Error(), "'server' is a required") {
	log.Println("discourse announce disabled: missing server")
}

Prevention

When it happens

Trigger: Calling Announce when ctx.Config.Announce.Discourse.Server == "" — i.e. the discourse announce pipe is enabled but no server value is set in .goreleaser.yaml or via environment/config parsing.

Common situations: Enabling discourse in the announce section without filling in the server field; relying on env expansion whose variable (e.g. ${DISCOURSE_SERVER}) is unset so it expands to empty.

Related errors


AI-assisted analysis of goreleaser/goreleaser@f5edd73956 (2026-09-05). Data as JSON: /api/errors/ab737936ac7ba10d. Report an issue: GitHub.