{"record":{"id":"7158ba88c17e5c99","repo":"goreleaser/goreleaser","slug":"errmultiplearchivessameplatform","errorCode":"ErrMultipleArchivesSamePlatform","errorMessage":"one nixpkg can handle only one archive of each OS/Arch combination","messagePattern":"one nixpkg can handle only one archive of each OS/Arch combination","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/pipe/nix/nix.go","lineNumber":38,"sourceCode":"\n\t\"github.com/caarlos0/log\"\n\t\"github.com/goreleaser/goreleaser/v2/internal/artifact\"\n\t\"github.com/goreleaser/goreleaser/v2/internal/client\"\n\t\"github.com/goreleaser/goreleaser/v2/internal/commitauthor\"\n\t\"github.com/goreleaser/goreleaser/v2/internal/experimental\"\n\t\"github.com/goreleaser/goreleaser/v2/internal/pipe\"\n\t\"github.com/goreleaser/goreleaser/v2/internal/skips\"\n\t\"github.com/goreleaser/goreleaser/v2/internal/summary\"\n\t\"github.com/goreleaser/goreleaser/v2/internal/tmpl\"\n\t\"github.com/goreleaser/goreleaser/v2/pkg/config\"\n\t\"github.com/goreleaser/goreleaser/v2/pkg/context\"\n)\n\nconst nixConfigExtra = \"NixConfig\"\n\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.","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/goreleaser/goreleaser/blob/f5edd7395693c0c6b501dc722d445d2e86af854d/internal/pipe/nix/nix.go#L20-L56","documentation":"The nix pipe builds one nixpkg derivation that must reference exactly one archive per OS/Arch combination. preparePkg collects archives into a map keyed by Goos+Goarch+Goarm; if a second archive maps to an existing key it returns ErrMultipleArchivesSamePlatform (internal/pipe/nix/nix.go:38, used at nix.go:344). This is a sentinel error so callers can check with errors.Is.","triggerScenarios":"Configuring nix for a build/archive setup that produces two archives for the same platform (e.g. two build ids both producing linux_amd64 archives included via nix.ids), such as a unibin-style config with duplicate archives per platform.","commonSituations":"Multiple builds without ids filtering on the nix pipe; archives produced both wrapped and unwrapped for the same platform; adding a second binary as a separate build instead of using builds' `binary` with a single build; the documented 'unibin' test case in nix_test.go:260.","solutions":["Set nix.ids to include only one build/archive per platform.","Merge multiple binaries into a single build (use builds[].main/binary) instead of separate builds producing same-platform archives.","Use nix.skip/archive-level filtering (e.g. internal binaries with build.skip) so duplicates for the same platform are excluded."],"exampleFix":"// before\nnix:\n  ids: [app, app-extra] // both produce linux_amd64 archives\n// after\nnix:\n  ids: [app]  // one archive per OS/Arch","handlingStrategy":"validation","validationCode":"// assert at most one archive per platform among nix-included ids\nnixIDs := map[string]bool{\"app\": true}\nseen := map[string]bool{}\nfor _, a := range ctx.Artifacts.Filter(artifact.ByType(artifact.UploadableArchive)).List() {\n    if !nixIDs[a.ExtraOr(\"ID\", \"\")] { continue }\n    key := a.Goos + a.Goarch + a.Goarm\n    if seen[key] { return fmt.Errorf(\"duplicate archive platform: %s\", key) }\n    seen[key] = true\n}","typeGuard":null,"tryCatchPattern":"if err := Pipe{}.Run(ctx); err != nil {\n    if errors.Is(err, nix.ErrMultipleArchivesSamePlatform) {\n        // drop second archive for same platform or split nix configs\n    }\n}","preventionTips":["One nix pipe entry should reference builds that produce exactly one archive per OS/Arch.","Consolidate binaries into a single build rather than parallel builds for the same platform.","Test with `goreleaser release --snapshot` on multi-platform configs before publishing."],"tags":["goreleaser","nix","config-conflict","duplicate-artifacts"],"backgroundTag":"duplicate-artifact-per-platform","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"}