{"record":{"id":"99ad81982b3599cc","repo":"goreleaser/goreleaser","slug":"could-not-pack-s-w-s","errorCode":null,"errorMessage":"could not pack %s: %w: %s","messagePattern":"could not pack (.+?): %w: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/pipe/upx/upx.go","lineNumber":93,"sourceCode":"\t}\n\tif upx.LZMA {\n\t\targs = append(args, \"--lzma\")\n\t}\n\tif upx.Brute {\n\t\targs = append(args, \"--brute\")\n\t}\n\targs = append(args, bin.Path)\n\tout, err := exec.CommandContext(ctx, upx.Binary, args...).CombinedOutput()\n\tif err != nil {\n\t\tfor _, ke := range knownExceptions {\n\t\t\tif strings.Contains(string(out), ke) {\n\t\t\t\tlog.WithField(\"binary\", bin.Path).\n\t\t\t\t\tWithField(\"exception\", ke).\n\t\t\t\t\tWarn(\"could not pack\")\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\treturn fmt.Errorf(\"could not pack %s: %w: %s\", bin.Path, err, string(out))\n\t}\n\n\tsizeAfter := sizeOf(bin.Path)\n\n\tlog.\n\t\tWithField(\"before\", units.HumanSize(float64(sizeBefore))).\n\t\tWithField(\"after\", units.HumanSize(float64(sizeAfter))).\n\t\tWithField(\"ratio\", fmt.Sprintf(\"%d%%\", (sizeAfter*100)/sizeBefore)).\n\t\tWithField(\"binary\", bin.Path).\n\t\tInfo(\"packed\")\n\n\treturn nil\n}\n\nvar knownExceptions = []string{\n\t\"CantPackException\",\n\t\"AlreadyPackedException\",\n\t\"NotCompressibleException\",","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/goreleaser/goreleaser/blob/f5edd7395693c0c6b501dc722d445d2e86af854d/internal/pipe/upx/upx.go#L75-L111","documentation":"The upx pipe compresses binaries with the external upx tool. If upx exits non-zero, goreleaser wraps the command error plus upx's combined output (string(out)). So this message contains both the Go-level failure and upx's own diagnostic text — read the trailing text to learn why upx refused the binary.","triggerScenarios":"compressOne runs upx on a built binary and the upx process returns an error and non-empty output that is not classified as ignorable (the code path above returns nil only for specific known exceptions like AlreadyPackedException/ CoronaException).","commonSituations":"upx not installed or wrong version in PATH (command not found output); archiving binaries upx cannot handle (e.g. certain arm64/M1 builds, signed binaries, Go binaries of some versions); already-packed binary; corrupted partial output file.","solutions":["Read the trailing `%s` output in the message — it contains upx's actual reason","Install/upgrade upx to a version supporting your target platform (upx >= 4.x for arm64 Darwin)","Set the binary as an ignorable exception or disable upx for that binary id (upx: enabled: false or use `upx.ids` filtering)","Ensure the binary is not already packed and is a valid executable for the host arch running upx"],"exampleFix":"# before\nupx:\n  enabled: true\n# after (skip binaries upx cannot pack)\nupx:\n  enabled: true\n  ids: [linux-amd64-bin] # exclude darwin/arm64 which upx may reject","handlingStrategy":"fallback","validationCode":"# pre-flight: is upx usable for this arch?\nupx --version || echo 'upx missing'\nfile dist/mybin # confirm architecture upx build supports","typeGuard":null,"tryCatchPattern":"if err := compress(bin); err != nil {\n\tlog.Warnf(\"upx failed for %s, shipping uncompressed: %v\", bin, err)\n\treturn shipUncompressed(bin) // fallback\n}","preventionTips":["Pin upx >= 4.x in CI images","Filter which binaries upx processes via ids","Read upx output embedded in the error for the exact cause","Test upx locally on the same platform before tagging a release"],"tags":["upx","compression","external-tool","binary"],"backgroundTag":"upx-pack-failed","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"}