{"record":{"id":"59a158b5027d17cb","repo":"plandex-ai/plandex","slug":"failed-to-download-the-update-w","errorCode":null,"errorMessage":"failed to download the update: %w","messagePattern":"failed to download the update: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/cli/upgrade.go","lineNumber":106,"sourceCode":"\t\t\t\tterm.OutputErrorAndExit(\"Failed to upgrade: %v\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tterm.StopSpinner()\n\t\t\trestartPlandex()\n\t\t} else {\n\t\t\tfmt.Println(\"Note: set PLANDEX_SKIP_UPGRADE=1 to stop upgrade prompts\")\n\t\t}\n\t}\n}\n\nfunc doUpgrade(version string) error {\n\ttag := fmt.Sprintf(\"cli/v%s\", version)\n\tescapedTag := url.QueryEscape(tag)\n\n\tdownloadURL := fmt.Sprintf(\"https://github.com/plandex-ai/plandex/releases/download/%s/plandex_%s_%s_%s.tar.gz\", escapedTag, version, runtime.GOOS, runtime.GOARCH)\n\tresp, err := http.Get(downloadURL)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to download the update: %w\", err)\n\t}\n\tdefer resp.Body.Close()\n\n\t// Create a temporary file to save the downloaded archive\n\ttempFile, err := os.CreateTemp(\"\", \"*.tar.gz\")\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to create temporary file: %w\", err)\n\t}\n\tdefer os.Remove(tempFile.Name()) // Clean up file afterwards\n\n\t// Copy the response body to the temporary file\n\t_, err = io.Copy(tempFile, resp.Body)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to save the downloaded archive: %w\", err)\n\t}\n\n\t_, err = tempFile.Seek(0, 0)\n\tif err != nil {","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/cli/upgrade.go#L88-L124","documentation":"doUpgrade in the Plandex CLI downloads the new release tarball from GitHub Releases via http.Get. If the HTTP request itself fails at the transport level (DNS failure, connection refused, TLS error, timeout), it wraps the net/http error with 'failed to download the update: %w'. This is thrown before any HTTP status is examined, so it only covers request-send failures, not 404s.","triggerScenarios":"checkForUpgrade detects a newer version, user confirms the upgrade, and http.Get on the GitHub Releases download URL fails at the transport layer — no network connectivity, DNS resolution failure, proxy/firewall blocking github.com, or TLS handshake error.","commonSituations":"Offline or corporate-proxy environments where github.com is unreachable; DNS misconfiguration; VPN dropouts; GitHub outage; IPv6 misconfig.","solutions":["Restore network connectivity to github.com (check DNS, proxy, VPN, firewall).","Set HTTPS_PROXY/HTTP_PROXY if behind a corporate proxy.","Retry the upgrade later or download and install the release manually.","Set PLANDEX_SKIP_UPGRADE=1 to bypass the upgrade prompt entirely."],"exampleFix":"// before (hard failure on any transport error)\nresp, err := http.Get(downloadURL)\nif err != nil {\n\treturn fmt.Errorf(\"failed to download the update: %w\", err)\n}\n// after (client with timeout; retry on transient failure)\nclient := &http.Client{Timeout: 60 * time.Second}\nvar resp *http.Response\nvar err error\nfor i := 0; i < 3; i++ {\n\tresp, err = client.Get(downloadURL)\n\tif err == nil {\n\t\tbreak\n\t}\n\ttime.Sleep(2 * time.Second)\n}\nif err != nil {\n\treturn fmt.Errorf(\"failed to download the update: %w\", err)\n}","handlingStrategy":"retry","validationCode":"url := fmt.Sprintf(\"https://github.com/plandex-ai/plandex/releases/download/cli/v%s/plandex_%s_%s_%s.tar.gz\", ver, ver, runtime.GOOS, runtime.GOARCH)\nif _, err := net.DialTimeout(\"tcp\", \"github.com:443\", 3*time.Second); err != nil {\n\treturn fmt.Errorf(\"github.com unreachable: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"var resp *http.Response\nvar err error\nfor attempt := 0; attempt < 3; attempt++ {\n\tresp, err = http.Get(downloadURL)\n\tif err == nil {\n\t\tbreak\n\t}\n\ttime.Sleep(time.Duration(1<<attempt) * time.Second)\n}\nif err != nil {\n\tfmt.Printf(\"upgrade skipped: %v\\n\", err) // degrade gracefully\n}","preventionTips":["Verify connectivity to github.com before running self-updates","Configure HTTPS_PROXY correctly in restricted networks","Use a client with a timeout instead of http.Get's default (no timeout)","Offer a manual-install fallback path when download fails"],"tags":["network","http","go","upgrade"],"backgroundTag":"http-request-failed","analyzedSha":"e2d772072efadbe41d2946d97d79be55532dbab5","analyzedAt":"2026-09-05T20:56:53.631Z","contentChangedAt":"2026-09-05T20:56:53.631Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}