{"record":{"id":"3f3a0e751e0a9941","repo":"goreleaser/goreleaser","slug":"could-not-open-q-w","errorCode":null,"errorMessage":"could not open %q: %w","messagePattern":"could not open %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/pipe/sourcearchive/source.go","lineNumber":91,"sourceCode":"\t\tPath: path,\n\t\tExtra: map[string]any{\n\t\t\tartifact.ExtraFormat: format,\n\t\t},\n\t})\n\treturn err\n}\n\nfunc appendExtraFilesToArchive(ctx *context.Context, prefix, name, format string) error {\n\toldPath := name + \".bkp\"\n\tif err := gio.Copy(name, oldPath); err != nil {\n\t\treturn fmt.Errorf(\"failed make a backup of %q: %w\", name, err)\n\t}\n\n\t// i could spend a lot of time trying to figure out how to append to a tar,\n\t// tgz and zip file... but... this seems easy enough :)\n\tof, err := os.Open(oldPath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not open %q: %w\", oldPath, err)\n\t}\n\tdefer of.Close()\n\n\taf, err := os.OpenFile(name, os.O_WRONLY|os.O_TRUNC, 0o644)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not open archive: %w\", err)\n\t}\n\tdefer af.Close()\n\n\tarch, err := archive.Copy(of, af, format)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfiles, err := archivefiles.Eval(tmpl.New(ctx), ctx.Config.Source.Files)\n\tif err != nil {\n\t\treturn err\n\t}","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/goreleaser/goreleaser/blob/f5edd7395693c0c6b501dc722d445d2e86af854d/internal/pipe/sourcearchive/source.go#L73-L109","documentation":"Raised when os.Open on the `.bkp` backup of the archive fails inside appendExtraFilesToArchive. After a successful backup, the pipe re-opens the backup as the read source for archive.Copy; failure here means the backup file is unreadable even though it was just written.","triggerScenarios":"os.Open(oldPath) returns an error right after gio.Copy succeeded — rare race, permission change, or filesystem issue on the `<name>.bkp` file.","commonSituations":"Antivirus/CI cleaners deleting temp files between steps, concurrent builds writing the same dist paths, or unusual umask/permissions in containers.","solutions":["Re-run the release in a clean dist directory (goreleaser release --clean or rm -rf dist).","Avoid concurrent goreleaser runs sharing the same dist folder.","Check filesystem permissions and any file watchers/AV that could remove the .bkp file."],"exampleFix":"// before (shared dist between parallel jobs)\n- run: goreleaser build --snapshot &\n// after\n- run: goreleaser build --snapshot --clean # unique dist per job","handlingStrategy":"try-catch","validationCode":"if _, err := os.Stat(oldPath); err != nil { return fmt.Errorf(\"backup vanished: %w\", err) }","typeGuard":null,"tryCatchPattern":"if err := appendExtraFilesToArchive(ctx, prefix, name, format); err != nil {\n    if strings.Contains(err.Error(), \"could not open\") {\n        // clean dist and re-run; check for concurrent jobs / AV deletion\n    }\n}","preventionTips":["Never share one dist/ directory across concurrent builds.","Disable antivirus/file watchers on CI dist paths.","Run --clean to start from a fresh dist."],"tags":["archive","filesystem","io"],"backgroundTag":"file-open-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"}