{"record":{"id":"937aa32596b37ece","repo":"github/copilot-sdk","slug":"failed-to-download-cli-binary-w","errorCode":null,"errorMessage":"failed to download CLI binary: %w","messagePattern":"failed to download CLI binary: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/cmd/bundler/main.go","lineNumber":442,"sourceCode":"\t\t\treturn bundleArtifacts{}, fmt.Errorf(\"failed to hash existing runtime wrapper: %w\", err)\n\t\t}\n\t\tassetsHash, err := sha256File(assetsArtifactPath)\n\t\tif err != nil {\n\t\t\treturn bundleArtifacts{}, fmt.Errorf(\"failed to hash existing runtime assets: %w\", err)\n\t\t}\n\t\treturn bundleArtifacts{outputPath, binaryHash, runtimeArtifactPath, runtimeHash, wrapperArtifactPath, wrapperHash, assetsArtifactPath, assetsHash}, nil\n\t}\n\n\t// Create temp directory for download\n\ttempDir, err := os.MkdirTemp(\"\", \"copilot-bundler-*\")\n\tif err != nil {\n\t\treturn bundleArtifacts{}, fmt.Errorf(\"failed to create temp dir: %w\", err)\n\t}\n\tdefer os.RemoveAll(tempDir)\n\n\tbinaryPath, tarballPath, err := downloadCLIBinary(info.runtimePlatform, info.binaryName, cliVersion, tempDir)\n\tif err != nil {\n\t\treturn bundleArtifacts{}, fmt.Errorf(\"failed to download CLI binary: %w\", err)\n\t}\n\n\tif outputDir != \".\" {\n\t\tif err := os.MkdirAll(outputDir, 0755); err != nil {\n\t\t\treturn bundleArtifacts{}, fmt.Errorf(\"failed to create output directory: %w\", err)\n\t\t}\n\t}\n\tif includeLicense {\n\t\tif err := extractCLILicense(tarballPath, outputPath); err != nil {\n\t\t\treturn bundleArtifacts{}, fmt.Errorf(\"failed to extract CLI license: %w\", err)\n\t\t}\n\t}\n\n\tbinaryHash, err := sha256File(binaryPath)\n\tif err != nil {\n\t\treturn bundleArtifacts{}, fmt.Errorf(\"failed to hash output binary: %w\", err)\n\t}\n\tif err := compressZstdFile(binaryPath, outputPath); err != nil {","sourceCodeStart":424,"sourceCodeEnd":460,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/go/cmd/bundler/main.go#L424-L460","documentation":"buildBundle failed to download the CLI binary/tarball for the target platform via downloadCLIBinary after creating the temp dir. This error wraps whatever downloadCLIBinary returned — typically an HTTP failure fetching the release asset, a 404 for the version/platform combination, or a checksum/extract failure.","triggerScenarios":"downloadCLIBinary(info.runtimePlatform, info.binaryName, cliVersion, tempDir) returns an error — bad cliVersion (no release exists), unsupported runtimePlatform/binaryName combination, network failure, or GitHub rate limiting on the release asset URL.","commonSituations":"cliVersion resolved from a stale package.json/lockfile pointing at a deleted release; downloading for a platform with no published binary; offline CI; asset renamed upstream between versions.","solutions":["Verify cliVersion corresponds to an existing release with assets for the platform.","Check network/proxy access to the release download host.","Confirm runtimePlatform/binaryName map to a real published asset name.","If rate limited (403), use authenticated requests or retry after the limit window.","Pin to a known-good cliVersion and rerun."],"exampleFix":"// before\nbinaryPath, tarballPath, err := downloadCLIBinary(info.runtimePlatform, info.binaryName, cliVersion, tempDir)\nif err != nil {\n\treturn bundleArtifacts{}, fmt.Errorf(\"failed to download CLI binary: %w\", err)\n}\n// after\nbinaryPath, tarballPath, err := downloadCLIBinary(info.runtimePlatform, info.binaryName, cliVersion, tempDir)\nif err != nil {\n\treturn bundleArtifacts{}, fmt.Errorf(\"failed to download CLI binary %s for %s: %w\", cliVersion, info.runtimePlatform, err)\n}","handlingStrategy":"retry","validationCode":"// preflight: check the release asset exists before downloading\nu := fmt.Sprintf(releaseURLFmt, cliVersion, info.binaryName)\nresp, err := http.Head(u)\nif err != nil || resp.StatusCode != http.StatusOK {\n\treturn fmt.Errorf(\"CLI binary %s for %s unavailable (status %v)\", cliVersion, info.runtimePlatform, resp)\n}","typeGuard":null,"tryCatchPattern":"artifacts, err := buildBundle(...)\nif err != nil && strings.Contains(err.Error(), \"failed to download CLI binary\") {\n\t// retry with backoff; if still failing, verify cliVersion/release exists\n\ttime.Sleep(5 * time.Second)\n\tartifacts, err = buildBundle(...)\n}","preventionTips":["Validate cliVersion maps to a published release before building.","Confirm the platform asset name matches what's published upstream.","Configure authenticated requests to avoid GitHub rate limits.","Use a download client with timeout and retry for flaky networks."],"tags":["download","network","http","release-assets"],"backgroundTag":"http-request-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"}