{"record":{"id":"8802a6383477d7eb","repo":"argoproj/argo-workflows","slug":"request-failed-with-w","errorCode":null,"errorMessage":"request failed with: %w","messagePattern":"request failed with: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/argo/commands/cp.go","lineNumber":137,"sourceCode":"\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &http.Client{Transport: &http.Transport{TLSClientConfig: tlsConfig}}, nil\n}\n\nfunc getAndStoreArtifactData(ctx context.Context, namespace string, workflowName string, nodeID string, artifactName string, fileName string, customPath string, c *http.Client, argoServerOpts apiclient.ArgoServerOpts) error {\n\trequest, err := http.NewRequestWithContext(ctx, http.MethodGet, fmt.Sprintf(\"%s/artifacts/%s/%s/%s/%s\", argoServerOpts.GetURL(), namespace, workflowName, nodeID, artifactName), nil)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to create request: %w\", err)\n\t}\n\tauthString, err := client.GetAuthString(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\trequest.Header.Set(\"Authorization\", authString)\n\tresp, err := c.Do(request)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"request failed with: %w\", err)\n\t}\n\tdefer resp.Body.Close()\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn fmt.Errorf(\"request failed %s\", resp.Status)\n\t}\n\tartifactFilePath := filepath.Join(customPath, fileName)\n\tfileWriter, err := os.Create(artifactFilePath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"creating file failed: %w\", err)\n\t}\n\tdefer fileWriter.Close()\n\t_, err = io.Copy(fileWriter, resp.Body)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"copying file contents failed: %w\", err)\n\t}\n\tlog.Printf(\"Created %q\", fileName)\n\treturn nil\n}","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/cmd/argo/commands/cp.go#L119-L155","documentation":"The artifact download HTTP request made by getAndStoreArtifactData failed at the transport level: c.Do(request) returned an error before a response was received. This covers DNS failure, connection refused/reset, TLS handshake errors, and context cancellation — not HTTP error statuses (those produce 'request failed %s').","triggerScenarios":"The argo server is not reachable at argoServerOpts.GetURL(): server down, wrong host/port, no port-forward, DNS failure, TLS certificate verification failure, or the context was cancelled (Ctrl-C / deadline) mid-request.","commonSituations":"Forgetting `kubectl -n argo port-forward svc/argo-server 2746:2746` locally; argo-server pod not running; self-signed certs without CA config (x509 errors); corporate proxy/VPN blocking; firewall between CI and the cluster.","solutions":["Confirm the server URL and that argo-server is up: `kubectl -n argo get pods`, `curl -k https://<host>:2746/`.","Set up the local port-forward or correct ARGO_SERVER/ARGO_HTTP1 env values.","If the error is x509/TLS, configure the CA cert or ARGO_INSECURE_SKIP_VERIFY=true for dev only.","If context cancelled, re-run with a longer deadline and don't interrupt the command mid-download."],"exampleFix":"// before (connection refused — nothing listening)\nargo cp my-wf ./out\n// after\nkubectl -n argo port-forward svc/argo-server 2746:2746 &\nargo cp my-wf ./out","handlingStrategy":"retry","validationCode":"# pre-flight connectivity check\ncurl -sk --max-time 5 \"${ARGO_SCHEME:-https}://${ARGO_SERVER:-localhost:2746}/\" >/dev/null || { echo \"argo server unreachable\"; exit 1; }","typeGuard":null,"tryCatchPattern":"// retry with backoff; surface TLS vs connection errors distinctly\nvar netErr net.Error\nif errors.As(err, &netErr) && netErr.Timeout() {\n  time.Sleep(time.Second); return retry()\n}\nif strings.Contains(err.Error(), \"x509\") {\n  return fmt.Errorf(\"TLS verification failed; configure CA cert or ARGO_INSECURE_SKIP_VERIFY\")\n}","preventionTips":["Run the kubectl port-forward before local cp commands.","Configure the server CA cert instead of disabling verification.","Add retry-with-backoff around downloads in CI pipelines.","Avoid cancelling (Ctrl-C) mid-download; use adequate command timeouts."],"tags":["cli","http","network","tls"],"backgroundTag":"connection-refused","analyzedSha":"35bff19146f5a6ada77468c431f2624bd577e373","analyzedAt":"2026-09-03T19:34:35.908Z","contentChangedAt":"2026-09-03T19:34:35.908Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}