{"record":{"id":"ab737936ac7ba10d","repo":"goreleaser/goreleaser","slug":"server-is-a-required-config-key","errorCode":null,"errorMessage":"'server' is a required config key","messagePattern":"'server' is a required config key","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/pipe/discourse/discourse.go","lineNumber":64,"sourceCode":"\t}\n\n\treturn nil\n}\n\nfunc (p Pipe) Announce(ctx *context.Context) error {\n\ttitle, err := tmpl.New(ctx).Apply(ctx.Config.Announce.Discourse.TitleTemplate)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tmsg, err := tmpl.New(ctx).Apply(ctx.Config.Announce.Discourse.MessageTemplate)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Make 'server' a required config field.\n\tif ctx.Config.Announce.Discourse.Server == \"\" {\n\t\treturn errors.New(\"'server' is a required config key\")\n\t}\n\n\t// Make 'category_id' a required config field.\n\tif ctx.Config.Announce.Discourse.CategoryID == 0 {\n\t\treturn errors.New(\"'category_id' is a required config key\")\n\t}\n\n\tcfg, err := env.ParseAs[Config]()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tpr := &postsRequest{\n\t\tTitle:    title,\n\t\tRaw:      msg,\n\t\tCategory: ctx.Config.Announce.Discourse.CategoryID,\n\t}\n","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/goreleaser/goreleaser/blob/f5edd7395693c0c6b501dc722d445d2e86af854d/internal/pipe/discourse/discourse.go#L46-L82","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set announce.discourse.server in .goreleaser.yaml to your forum URL","Ensure any environment variable used for the server value is exported in CI","Remove/comment the discourse announce block if you don't use Discourse"],"exampleFix":"// before\nannounce:\n  discourse:\n    category_id: 5\n// after\nannounce:\n  discourse:\n    server: https://forum.example.com\n    category_id: 5","handlingStrategy":"validation","validationCode":"if ctx.Config.Announce.Discourse.Server == \"\" {\n\tlog.Fatal(\"announce.discourse.server must be set\")\n}","typeGuard":null,"tryCatchPattern":"if err := pipe.Announce(ctx); err != nil && strings.Contains(err.Error(), \"'server' is a required\") {\n\tlog.Println(\"discourse announce disabled: missing server\")\n}","preventionTips":["Run `goreleaser check` before releases","Avoid empty-expanding env templates for required fields","Keep announce config minimal to only used services"],"tags":["goreleaser","config","discourse","validation"],"backgroundTag":"missing-required-config-key","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"}