{"record":{"id":"932a2564345f18e2","repo":"goreleaser/goreleaser","slug":"nix-license-is-invalid","errorCode":null,"errorMessage":"nix.license is invalid","messagePattern":"nix\\.license is invalid","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/pipe/nix/nix.go","lineNumber":53,"sourceCode":"\n// ErrMultipleArchivesSamePlatform happens when the config yields multiple\n// archives for the same platform.\nvar ErrMultipleArchivesSamePlatform = errors.New(\"one nixpkg can handle only one archive of each OS/Arch combination\")\n\ntype errNoArchivesFound struct {\n\tgoamd64 string\n\tids     []string\n}\n\nfunc (e errNoArchivesFound) Error() string {\n\treturn 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)\n}\n\nvar (\n\terrNoRepoName     = pipe.Skip(\"repository name is not set\")\n\terrSkipUpload     = pipe.Skip(\"nix.skip_upload is set\")\n\terrSkipUploadAuto = pipe.Skip(\"nix.skip_upload is set to 'auto', and current version is a pre-release\")\n\terrInvalidLicense = errors.New(\"nix.license is invalid\")\n)\n\n// New returns a pipe to be used in the publish phase.\nfunc New() Pipe {\n\treturn Pipe{realHasher}\n}\n\ntype Pipe struct {\n\thasher fileHasher\n}\n\nfunc (Pipe) String() string                           { return \"nixpkgs\" }\nfunc (Pipe) ContinueOnError() bool                    { return true }\nfunc (Pipe) Dependencies(_ *context.Context) []string { return []string{nixHashBin} }\n\nfunc (p Pipe) Skip(ctx *context.Context) bool {\n\treturn skips.Any(ctx, skips.Nix) || len(ctx.Config.Nix) == 0\n}","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/goreleaser/goreleaser/blob/f5edd7395693c0c6b501dc722d445d2e86af854d/internal/pipe/nix/nix.go#L35-L71","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nnix:\n  license: MIT OR Apache-2.0\n// after\nnix:\n  license: mit","handlingStrategy":"validation","validationCode":"func validNixLicense(lic string) error {\n    if lic == \"\" { return nil }\n    switch strings.ToLower(lic) {\n    case \"mit\", \"apache-2.0\", \"bsd-3-clause\", \"bsd-2-clause\", \"mpl-2.0\", \"gpl-3.0-only\":\n        return nil\n    }\n    return fmt.Errorf(\"license %q not in goreleaser validLicenses\", lic)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["goreleaser","nix","validation","spdx-license"],"backgroundTag":"invalid-license-identifier","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"}