{"record":{"id":"675046d643b8fe54","repo":"github/copilot-sdk","slug":"failed-to-open-release-package-w","errorCode":null,"errorMessage":"failed to open release package: %w","messagePattern":"failed to open release package: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/cmd/bundler/main.go","lineNumber":1087,"sourceCode":"\tfmt.Printf(\"Downloaded %s (%.1f MB)\\n\", binaryName, sizeMB)\n\n\treturn binaryPath, tarballPath, nil\n}\n\n// extractCLILicense writes the license from the verified release package next to outputPath.\nfunc extractCLILicense(tarballPath, outputPath string) error {\n\toutputDir := filepath.Dir(outputPath)\n\tif outputDir == \"\" {\n\t\toutputDir = \".\"\n\t}\n\tlicensePath := licensePathForOutput(outputPath)\n\tif _, err := os.Stat(licensePath); err == nil {\n\t\treturn nil\n\t}\n\n\tsource, err := os.Open(tarballPath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to open release package: %w\", err)\n\t}\n\tdefer source.Close()\n\n\tgzReader, err := gzip.NewReader(source)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to create gzip reader: %w\", err)\n\t}\n\tdefer gzReader.Close()\n\n\ttarReader := tar.NewReader(gzReader)\n\tfor {\n\t\theader, err := tarReader.Next()\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to read tar: %w\", err)\n\t\t}","sourceCodeStart":1069,"sourceCodeEnd":1105,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/go/cmd/bundler/main.go#L1069-L1105","documentation":"extractCLILicense skips work when the license already exists; otherwise it opens the downloaded release tarball to pull out package/LICENSE.md. If os.Open(tarballPath) fails, this error wraps it. It means the saved tarball is not readable at the path downloadCLIBinary reported.","triggerScenarios":"os.Open(tarballPath) returns non-nil — the tarball was deleted between download and license extraction, the path is wrong, or permission to read it is missing.","commonSituations":"Concurrent build cleaned the temp tarball; tarball removed by a cleanup step; running extractCLILicense with a hand-supplied path that doesn't exist; restrictive umask/permissions.","solutions":["Ensure the tarball from downloadCLIBinary is retained until extractCLILicense has run.","Verify tarballPath exists and is readable (ls -l) before calling buildBundle steps manually.","Avoid sharing temp directories across concurrent builds; use isolated dirs.","Re-download the release if the tarball is gone."],"exampleFix":"// before: removing tarball before license extraction\nos.Remove(tarballPath)\nextractCLILicense(tarballPath, outputDir, licensePath)\n\n// after: extract license first, clean up afterwards\nextractCLILicense(tarballPath, outputDir, licensePath)\nos.Remove(tarballPath)","handlingStrategy":"validation","validationCode":"if _, err := os.Stat(tarballPath); err != nil {\n    return fmt.Errorf(\"release tarball %s unavailable before license extraction: %w\", tarballPath, err)\n}","typeGuard":null,"tryCatchPattern":"if err := buildBundle(...); err != nil {\n    if strings.Contains(err.Error(), \"failed to open release package\") {\n        reDownload(); return retryBuild()\n    }\n    return err\n}","preventionTips":["Keep the tarball alive until all consumers (checksum, extraction, license) finish.","Clean up tarballs only at the very end of buildBundle.","Avoid concurrent builds sharing the same temp tarball path.","Pass the exact tarballPath returned by downloadCLIBinary."],"tags":["filesystem","tarball","license","go"],"backgroundTag":"file-open-failed","analyzedSha":"cd8cf15dc3f9e762615790aaed0a771a0f392755","analyzedAt":"2026-09-09T18:32:31.973Z","contentChangedAt":"2026-09-09T18:32:31.973Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}