goreleaser/goreleaser · error
nix.license is invalid
Error message
nix.license is invalid
What it means
The nix pipe validates nix.license against a known SPDX license list in Default. If a non-empty nix.license value is not in slices.Contains(validLicenses, ...), it wraps errInvalidLicense with the offending value (internal/pipe/nix/nix.go:53, checked at nix.go:89). It fails during the default/build phase, before publishing.
Source
Thrown at internal/pipe/nix/nix.go:53
// ErrMultipleArchivesSamePlatform happens when the config yields multiple
// archives for the same platform.
var ErrMultipleArchivesSamePlatform = errors.New("one nixpkg can handle only one archive of each OS/Arch combination")
type errNoArchivesFound struct {
goamd64 string
ids []string
}
func (e errNoArchivesFound) Error() string {
return fmt.Sprintf("no archives found matching goos=[darwin linux] goarch=[amd64 arm arm64 386] goarm=[6 7] goamd64=%s ids=%v", e.goamd64, e.ids)
}
var (
errNoRepoName = pipe.Skip("repository name is not set")
errSkipUpload = pipe.Skip("nix.skip_upload is set")
errSkipUploadAuto = pipe.Skip("nix.skip_upload is set to 'auto', and current version is a pre-release")
errInvalidLicense = errors.New("nix.license is invalid")
)
// New returns a pipe to be used in the publish phase.
func New() Pipe {
return Pipe{realHasher}
}
type Pipe struct {
hasher fileHasher
}
func (Pipe) String() string { return "nixpkgs" }
func (Pipe) ContinueOnError() bool { return true }
func (Pipe) Dependencies(_ *context.Context) []string { return []string{nixHashBin} }
func (p Pipe) Skip(ctx *context.Context) bool {
return skips.Any(ctx, skips.Nix) || len(ctx.Config.Nix) == 0
}View on GitHub (pinned to f5edd73956)
Solutions
- Set nix.license to an exact valid identifier from goreleaser's list (e.g. 'mit', 'apache-2.0') — check the list in internal/pipe/nix/nix.go (validLicenses).
- Remove nix.license if it can't be mapped; empty values are allowed.
- Match the identifier casing/format used in your Cargo.toml/pyproject equivalent, since goreleaser mirrors those SPDX ids strictly.
Example fix
// before nix: license: MIT OR Apache-2.0 // after nix: license: mit
Defensive patterns
Strategy: validation
Validate before calling
func validNixLicense(lic string) error {
if lic == "" { return nil }
switch strings.ToLower(lic) {
case "mit", "apache-2.0", "bsd-3-clause", "bsd-2-clause", "mpl-2.0", "gpl-3.0-only":
return nil
}
return fmt.Errorf("license %q not in goreleaser validLicenses", lic)
} Prevention
- Copy license identifiers exactly from goreleaser's nix validLicenses list, not from arbitrary package manifests.
- Avoid SPDX compound expressions (A OR B); pick a single supported identifier.
- Run `goreleaser check` (Default runs validation) before release.
When it happens
Trigger: Setting nix.license to a string not on goreleaser's validLicenses list — e.g. a full SPDX expression like 'MIT OR Apache-2.0', a misspelled identifier like 'APACHE-2.0' instead of 'Apache-2.0', or a custom proprietary string.
Common situations: Copying a license from Cargo/package.json with different casing or formatting; using SPDX compound expressions unsupported by the list; typos in license identifiers when migrating to the nix pipe.
Related errors
- 'server' is a required config key
- 'category_id' is a required config key
- no tags provided
- no app_id provided for flatpak
- no runtime provided for flatpak
AI-assisted analysis of goreleaser/goreleaser@f5edd73956 (2026-09-05).
Data as JSON: /api/errors/932a2564345f18e2.
Report an issue: GitHub.