{"record":{"id":"c12ecbd075ad140f","repo":"pulumi/pulumi","slug":"failed-to-download-s-w","errorCode":null,"errorMessage":"failed to download %s: %w","messagePattern":"failed to download (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdk/go/auto/cmd.go","lineNumber":176,"sourceCode":"\t\tif err := installWindows(ctx, opts.Version, opts.Root); err != nil {\n\t\t\treturn pulumiCommand{}, err\n\t\t}\n\t} else {\n\t\tif err := installPosix(ctx, opts.Version, opts.Root); err != nil {\n\t\t\treturn pulumiCommand{}, err\n\t\t}\n\t}\n\treturn NewPulumiCommand(opts)\n}\n\nfunc downloadToTmpFile(ctx context.Context, url, filePattern string) (_ string, err error) {\n\treq, err := http.NewRequestWithContext(ctx, \"GET\", url, nil)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tresp, err := httputil.DoWithRetry(req, http.DefaultClient)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to download %s: %w\", url, err)\n\t}\n\tdefer resp.Body.Close()\n\tscriptData, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to read response from %s: %w\", url, err)\n\t}\n\ttmp, err := os.CreateTemp(\"\", filePattern)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tscriptPath := tmp.Name()\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tos.Remove(scriptPath)\n\t\t}\n\t}()\n\t// The permissions here are ignored because the tmp file already exists.\n\t// We need to explicitly call chmod below to set the desired permissions.","sourceCodeStart":158,"sourceCodeEnd":194,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/sdk/go/auto/cmd.go#L158-L194","documentation":"Thrown when the automation API downloads the pulumi install script over HTTP and the request fails after retries. It wraps the network error with the failing URL. Indicates connectivity, DNS, TLS, or HTTP status issues reaching the download host.","triggerScenarios":"Calling install (e.g. installPosix via pulumi install path in sdk/go/auto/cmd.go) when httputil.DoWithRetry on http.NewRequestWithContext GET to https://get.pulumi.com/install.sh fails — no network, DNS failure, proxy misconfig, or repeated 5xx.","commonSituations":"Running in an air-gapped/CI environment without internet; corporate proxy blocking get.pulumi.com; TLS interception certificates not trusted; transient provider outage.","solutions":["Verify network connectivity to the URL (curl -I https://get.pulumi.com/install.sh)","Configure HTTP(S)_PROXY environment variables if behind a corporate proxy","Pre-install the Pulumi CLI manually so the download path is not taken","Retry later if the wrapped error indicates a 5xx/transient failure (the call already retries)"],"exampleFix":"// before\nerr := installPosix(ctx, v, root) // fails offline\n// after\nexport HTTPS_PROXY=http://proxy.corp:8080\n// or pre-install:\ncurl -fsSL https://get.pulumi.com/install.sh | sh","handlingStrategy":"retry","validationCode":"req, _ := http.NewRequestWithContext(ctx, http.MethodGet, \"https://get.pulumi.com/install.sh\", nil)\nif _, err := http.DefaultClient.Do(req); err != nil {\n    return fmt.Errorf(\"precheck: cannot reach get.pulumi.com: %w\", err)\n}","typeGuard":"func isNetworkErr(err error) bool {\n    var ne net.Error\n    return errors.As(err, &ne) || errors.Is(err, context.DeadlineExceeded)\n}","tryCatchPattern":"err := install(ctx, version, root)\nif err != nil {\n    if strings.Contains(err.Error(), \"failed to download\") {\n        return retryWithBackoff(ctx, 3, func() error { return install(ctx, version, root) })\n    }\n    return err\n}","preventionTips":["Pre-install the pulumi CLI in CI/air-gapped environments to skip downloading","Configure HTTPS_PROXY/HTTP_PROXY for corporate networks","Trust corporate TLS root CAs in the Go cert pool","Add retries with backoff around automation API calls that may install the CLI"],"tags":["go","network","download"],"backgroundTag":"http-download-failed","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}